class Form<K>
The form definition class. Can be used directly or indirectly inside a FormPanel.
Form(panel: FormPanel<K>? = null, modelFactory: (Map<String, Any?>) -> K)
Creates a form with a given modelFactory function |
fun <C : FormControl> add(key: String, control: C, required: Boolean = false, validatorMessage: (C) -> String? = null, validator: (C) -> Boolean? = null): Form<K>
Adds a control to the form. |
|
fun clearData(): Unit
Sets the values of all controls to null. |
|
operator fun get(key: String): Any?
Returns a value of the control of given key. |
|
fun getControl(key: String): FormControl?
Returns a control of given key. |
|
fun getData(): K
Returns current data model. |
|
fun getDataJson(): Json
Returns current data model as JSON. |
|
fun remove(key: String): Form<K>
Removes a control from the form. |
|
fun removeAll(): Form<K>
Removes all controls from the form. |
|
fun setData(model: K): Unit
Sets the values of all the controls from the model. |
|
fun validate(): Boolean
Invokes validator function and validates the form. |