Home
Stefan Meyer edited this page Dec 24, 2013
·
14 revisions
Start reading about gform here.
gform provides a widget that renders a form according to a schema. gform uses dojo as the widget library. Main usage is the creation of administrative front ends. The model driven approach lends itself perfectly to creating a form for backend data models.
json literals are made up of properties. In gform these properties are referred to as attributes.
###Features
- dojo clientside validation is supported.
- serverside validation is supported. The error message can be set by a path expression.
editor.addError("addresses.0.name","the name is not valid")
. Errors added in this manner can be removed by callingeditor.resetErrors()
. - changes to attributes are tracked. Each attribute label is decorated with an icon to signal that it was changed. The tooltip contains the original value.
- groups can be used to add structure to the display of the form. Without a group all attributes are simply displayed in a list. A group can display group of attributes in a tabs, accordions or similar containers. Groups indicate the number of invalid attributes next to the label.
- The data displayed in the form can be programmatically modified after form creation. The form will be updated accordingly. This is useful for browsing the details of elements in a table. The details form is updated when the user switches between elements in the table.
- Attributes in the model can be updated by path expressions
editor.update("stocks.apple.price",12.2)
. This is useful to display serverside changes to the model. - A function is provided to convert json schema into the gform schema.
###Limitations
Currently the schema does not allow for a properties with arbitrary keys. This can be emulated by using an array with a unique key property.