ampersand-questionnaire-view v1.0.0
ampersand-questionnaire-view
More generically, you may think of this as ampersand-form-manager
or ampersand-form-manager-view
. Manage groups of forms! Use to either render forms within, gather meta about a collection of forms, or to display data about the group of forms.
This module can be used to manage various forms as though they were subsets of a larger, grander form.
demo
The demo is tightly coupled to all of the examples used in the tests. Run npm run demo
to check out each example!
API Reference
autoAppend boolean
add forms to questionnaire-view container
complete boolean
true
when all forms in forms
collection are valid
.
ToDo, change from checking valid
to complete
or submitted
, if we can make them available in FormView
completeCallback Function
Fired when all forms are complete (valid).
completed Array
Returns an array of valid form views
current FormView
current form rendered by view
formContainer Element
node which module renders views into
forms Collection
collections of forms
next Functions
Sets the view to the next form. If no forms available, does nothing
remaining Array
Returns an array of invalid form views
set(FormView)
Sets the View's switcher to the requested form. Throws Error if the requested FormView not present
template String|Function
Template must contain an element with data-hook="form-container"
to render the forms in if the view is to be rendered. The default view may be used
value FormView
default form loaded in view
eagerLoad boolean
Render forms in formContainer
on render()
true
//=> loads first form'all'
//=> loads all forms // TODO[key1, key3]
//=> ToDo loads select forms into containers based on id // TODOfunction() { ... }
//=> ToDorun against all forms. loads forms where function returns true when run against form // TODO
Todo
- Convert ampersand-form-view dependency to upstream once 3.0.0 PR and
autoRender: false
support make it in to core eagerLoad
ToDos- Use better indicator that a form is complete than
valid
- Better support for some ampersand fields that currently don't report a valid value.
- Add cached mixin, extend FormView, or PR FormView for setting
completed
on the Form for improving this module'scomplete
accuracy
9 years ago