Warning |
---|
The UI Framework code is being transitioned to a module. Documentation will move to UI Framework. |
Usage
Code Block | ||
---|---|---|
| ||
${ ui.includeFragment("widgets/field", [ class: org.openmrs.Role.class, formFieldName: "role"]) } // will delegate to (i.e. include) the "fields/org.openmrs.Role" fragment |
How to write a field
- Create a fragment under the "fields" folder as "the.package.ClassName". (TODO where would you put the controller?).
- Do not implement a label (so that one may be added by the labeledField widget)
- Do include a span to display errors with id "${ id }-error"
...
- "${ config.parentFormId }.reset"
- -> your field should clear its value and any error messages it is currently displaying
- "${ config.parentFormId }.clear-errors"
- -> your field should clear any error messages it is currently displaying ** TODO why do we need this?
- "${ config.parentFormId }/${ config.formFieldName }.show-errors
- includes an array of string error messages as its payload
- -> your field should display the given errors in its error span