Forms¶
Emakin forms utilize a Model-View-Controller (MVC) architecture for rendering and processing. The form and its constituent widgets act as the view, the data model serves as the model, and scripting provides the controller functionality.
Widgets¶
Widgets are responsible for displaying data from the data model and for updating the model based on user interactions ( e.g., text entry, dropdown selection, table row addition).
Widgets are categorized as either container widgets or control widgets.
-
Container Widgets: These group and arrange other widgets, providing a layout structure. Examples include row containers (arranging widgets horizontally) and tab containers (organizing widgets into tabs).
-
Control Widgets: These directly interact with the data model, displaying and modifying its values. Examples include text boxes (displaying and accepting text input) and dropdown lists (presenting choices and capturing selections).
Each widget is bound to a specific location within the data model via an XPath expression. This expression determines how the widget retrieves and updates data within the model. Nested widgets inherit the XPath expression from their parent container widget. For example, a text box widget nested within a row container inherits the row's XPath binding.
Rules¶
Widget behavior in Emakin forms can be controlled using rules. These rules define when widgets should be:
- Visible: Controls whether a widget is displayed on the form.
- Read-only: Makes the widget un-editable or read-only while still visible.
- Required: Ensures that a value must be provided before form submission.
These rules enable dynamic and context-sensitive form interactions, ensuring a responsive and user-friendly experience tailored to the form's data model and user actions.
Data Model¶
The data model stores the form's data and provides it to the widgets. Its XML structure allows for hierarchical data representation.
The data model is validated against the process definition schema. This validation ensures structural integrity but does not verify data validity. Data validation is handled by individual widgets, triggered by user interactions.
Scripting¶
Scripting allows attaching event handlers to the data model. These handlers are invoked when the data model changes, either through widget interactions or through explicit script actions.
Scripts can manipulate the data model, performing calculations, fetching data from external sources, and updating model values.
Style Customization¶
Emakin forms support CSS custom styling, enabling developers to customize the appearance of form elements according to specific design requirements. This feature enhances the visual presentation of forms, ensuring consistency with corporate branding and improving user experience.