FormHandler
Handles the form's lifecycle - the main coordinator of the form system.
FormHandler coordinates all form components:
FormSchema - the structure and controls of the form
FormState - reactive state of all controls
FormDataManager - loading data from the database and processing results
FormValidator - field and business-rule validation
Lifecycle:
Initialize the components and wire references between them
Load data (editing) or set default values (new record)
Handle user actions (validation + running the action)
The handler knows nothing about navigation or about what happens after an action - it only returns true/false from triggerAction. The decision "saving closes the screen" is made by the button's lambda in the schema builder.
Parameters
Builder providing the form's structure.
Manager responsible for data operations.
Validator checking the data.
Additional data passed to the form (e.g. a parent ID).
CoroutineScope for asynchronous operations.
Constructors
Properties
Functions
API for FormView - access to the form components
Sets the form component references on all controls.
Asynchronously fetches the initial values from FormDataManager.initData (in handlerScope) and creates the control states from them.
Runs the whole action: validation, collecting the form data, executing the action.
Collects the form data if it passes validation, or returns null when one of the stages failed it. The stage itself records the errors to show, in errorManager.