FormBuilderDSL.Context (form_builder_dsl v0.1.2)
View SourceProvides form context and state management.
This module helps manage form state, including:
- Field values
- Validation errors
- Form submission state
- Field dependencies
Summary
Functions
Gets the error message for a field.
Checks if a field has an error.
Creates a new form context.
Updates a field value in the form context.
Checks if the form is valid.
Validates all fields in the form context.
Types
Functions
Gets the error message for a field.
Parameters
context
- The form contextfield
- The field key
Returns
- Error message if the field has an error
nil
if the field has no error
Checks if a field has an error.
Parameters
context
- The form contextfield
- The field key
Returns
true
if the field has an errorfalse
otherwise
Creates a new form context.
Parameters
form_name
- The name of the formfields
- List of field definitionsopts
- Additional options
Options
:values
- Initial field values:dependencies
- Field dependencies
Updates a field value in the form context.
Parameters
context
- The form contextfield
- The field keyvalue
- The new value
Checks if the form is valid.
Parameters
context
- The form context
Returns
true
if the form has no errorsfalse
otherwise
Validates all fields in the form context.
Parameters
context
- The form context
Returns
- Updated context with validation errors