This field allows a arbitrary list of embeddable forms. The forms available are defined by the embeddable_forms attribute, in the same way as forms available in to embed in a rich text field are defined.
The #fill method of the many forms field builds a list of children composed of ChildForm elements. The ChildForm element provides a form and schema attribute that is used to validate and fill the data and convert to form AST. The many_forms #to_ast builds it's list of children AST from each of these elements.
As a bonus this ChildForm element also gave us the ability to easily define a singular FormField class, that can be used to embed a single embeddable form in another form. eg:
Helper classes are also provided for validating and co-ercing the data received on form submit. The ValidityCheck class is initialized with the form container and when called provides a boolean value indicating whether the data is valid. eg:
This PR provides a new field type defined by the class ManyForms, and created in the form definition as:
This field allows a arbitrary list of embeddable forms. The forms available are defined by the
embeddable_forms
attribute, in the same way as forms available in to embed in a rich text field are defined.The
#fill
method of the many forms field builds a list of children composed ofChildForm
elements. The ChildForm element provides a form and schema attribute that is used to validate and fill the data and convert to form AST. The many_forms#to_ast
builds it's list of children AST from each of these elements.As a bonus this ChildForm element also gave us the ability to easily define a singular FormField class, that can be used to embed a single embeddable form in another form. eg:
Helper classes are also provided for validating and co-ercing the data received on form submit. The
ValidityCheck
class is initialized with the form container and when called provides a boolean value indicating whether the data is valid. eg:The
ParmsProcessor
class runs the params validations over the data to co-erce the data to the correct types. eg:The ruby changes are supported by changes to the JS libraries in the following PRs: team-formalist/formalist-standard-react#178 team-formalist/formalist-compose-js#22 team-formalist/formalist-data-object-renderer#2