- Added a
#with
method toEmbeddedFormRenderer
to support additional call time options
- Update to ruby to version 3
- Update dry-configurable to version 0.13
- Add support a field with an arbitrary list of forms. Supporting updates in formalist-standard-react@^4.2.0
- Add namespace and paths options to embedded form renderer
- Support dry-schema/dry-validation 1.0
- Removed dry-types dependency from core gem
- Fixed the rendering of validation errors when validating a
Many
element itself
- Added
initial_attributes_url
attribute toUploadField
andMultiUploadField
- Added
clear_query_on_selection
attribute toSearchMultiSelectionField
- Add
disabled
attribute toTextField
- Add
time_format
andhuman_time_format
attributes toDateTimeField
- Add
sortable
andmax_height
attributes toMany
,MultiSelectionField
,MultiUploadField
, andSearchMultiSelectionField
- Allow falsey attribute values to be passed through in AST
- Add
render_option_control_as
option to search select fields
- dry-types dependency updated to 0.13
- Errors passed to
#fill
are now properly stored on the form's elements
- Private form methods are accessible from within definition blocks
- Fixed issue with Form::Validity check crashing while processing
many
elements
rich_text_area
field type, support for embedding and validating forms within rich text areas, and rendering the rich text from its native draft.js AST format to HTMLsearch_selection_field
andmulti_search_selection_field
field types- Various improvements to the upload fields, including support for passing
presign_options
- [BREAKING] Form definition blocks are now evaluated within the context of the form instance's
self
, which mean dependencies can be injected into the form object and accessed from the form definition block.#dep
within the definition block has thusly been removed. - [BREAKING]
Formalist::Form
should now be instantiated (form = MyForm.new
) and then filled withform.fill(input: input_data, errors: error_messages)
.Form#fill
returns a copy of the form object with all the elements filled with the input data and error messages as required.Form#call
has been removed, along withFormalist::Form::Result
(which was the object returned from#call
).
- Form elements no longer have a
permitted_children
config. For now, this should be handled by convention only.
Add support for upload and multi upload fields.
Default check_box element values to false.
Remove local type coercion using dry-data. We rely on a Dry::Validation::Schema
to do this now. The form definition API has not yet changed, though. We still require field types to be specified, but there is no longer any restriction over what is entered. We'll remove this in a future release, once we can infer types from the schema.
Fix issue where form could not be built with input data with native data types (it presuming input would be HTML form-style input everywhere).
Add default (empty) input data argument for Form#build
. This allows you simply to call MyForm.build
for creating a "new" form (i.e. one without any existing input data).
Require a dry-validation schema for each form. The schema should completely represent the form's expected data structure.
Update the API to better support the two main use cases for a form. First, to prepare a form with sane, initial input from your database and send it to a view for rendering:
my_form = MyForm.new(my_schema)
my_form.build(input) # returns a `Formalist::Form::Result`
Then, to receive the data from the posted form, coerce it and validate it (and potentially re-display the form with errors):
my_form = MyForm.new(my_schema)
my_form.receive(input).validate # returns a `Formalist::Form::ValidatedResult`
The main differences are as such:
#build
expects already-clean (e.g. properly structured and typed) data#receive
expects the kind of data that your form will submit, and will then coerce it according to the validation schema, and then send the sanitised output to#build
- Calling
#validate
on a result object will validate the input data and include any error messages in its AST
Initial release.