open class FormPanel<K : Any> : SimplePanel
Bootstrap form component.
FormPanel(method: FormMethod? = null, action: String? = null, enctype: FormEnctype? = null, type: FormType? = null, classes: Set<String> = setOf(), serializer: KSerializer<K>) |
var action: String?
The URL address to send data. |
|
var autocomplete: Boolean?
Determines if the form should have autocomplete. |
|
var enctype: FormEnctype?
The form encoding type. |
|
var method: FormMethod?
HTTP method. |
|
var name: String?
The form name. |
|
var novalidate: Boolean?
Determines if the form is not validated. |
|
var target: FormTarget?
The form target. |
|
var validator: (Form<K>) -> Boolean?
Validation function. |
|
var validatorMessage: (Form<K>) -> String?
Function returning validation message. |
open fun <C : StringFormControl> add(key: KProperty1<K, String?>, control: C, required: Boolean = false, requiredMessage: String? = null, validatorMessage: (C) -> String? = null, validator: (C) -> Boolean? = null): FormPanel<K>
Adds a string control to the form panel. open fun <C : BoolFormControl> add(key: KProperty1<K, Boolean?>, control: C, required: Boolean = false, requiredMessage: String? = null, validatorMessage: (C) -> String? = null, validator: (C) -> Boolean? = null): FormPanel<K>
Adds a boolean control to the form panel. open fun <C : NumberFormControl> add(key: KProperty1<K, Number?>, control: C, required: Boolean = false, requiredMessage: String? = null, validatorMessage: (C) -> String? = null, validator: (C) -> Boolean? = null): FormPanel<K>
Adds a number control to the form panel. open fun <C : DateFormControl> add(key: KProperty1<K, Date?>, control: C, required: Boolean = false, requiredMessage: String? = null, validatorMessage: (C) -> String? = null, validator: (C) -> Boolean? = null): FormPanel<K>
Adds a date control to the form panel. open fun <C : KFilesFormControl> add(key: KProperty1<K, List<KFile>?>, control: C, required: Boolean = false, requiredMessage: String? = null, validatorMessage: (C) -> String? = null, validator: (C) -> Boolean? = null): FormPanel<K>
Adds a files control to the form panel. |
|
fun <C : FormControl> addInternal(key: KProperty1<K, *>, control: C, required: Boolean = false, requiredMessage: String? = null, validatorMessage: (C) -> String? = null, validator: (C) -> Boolean? = null): FormPanel<K> |
|
open fun clearData(): Unit
Sets the values of all controls to null. |
|
operator fun get(key: KProperty1<K, *>): Any?
Returns a value of the control of given key. |
|
open fun getControl(key: KProperty1<K, *>): FormControl?
Returns a control of given key. |
|
open fun getData(): K
Returns current data model. |
|
open fun getDataJson(): Json
Returns current data model as JSON. |
|
open fun getSnAttrs(): List<StringPair>
Returns list of element attributes in the form of a List. |
|
open fun getSnClass(): List<StringBoolPair>
Returns list of CSS class names for current widget in the form of a List. |
|
open fun remove(key: KProperty1<K, *>): FormPanel<K>
Removes a control from the form panel. |
|
open fun removeAll(): FormPanel<K>
Removes all children from the current container. |
|
open fun render(): VNode
Renders current component as a Snabbdom vnode. |
|
open fun setData(model: K): Unit
Sets the values of all the controls from the model. |
|
open fun validate(): Boolean
Invokes validator function and validates the form. |
open fun add(child: Component): SimplePanel
Adds given component to the current container. |
|
open fun addAll(children: List<Component>): SimplePanel
Adds a list of components to the current container. |
|
fun addInternal(child: Component): SimplePanel
Protected and final method to add given component to the current container. |
|
open fun childrenVNodes(): Array<VNode>
Returns the array of the children Snabbdom vnodes. |
|
open fun getChildren(): List<Component>
Returns a list of children of the current container. |
|
open fun remove(child: Component): SimplePanel
Removes given component from the current container. |
fun <K : Any> create(method: FormMethod? = null, action: String? = null, enctype: FormEnctype? = null, type: FormType? = null, classes: Set<String> = setOf(), init: FormPanel<K>.() -> Unit = null): FormPanel<K> |
|
fun <K : Any> Container.formPanel(method: FormMethod? = null, action: String? = null, enctype: FormEnctype? = null, type: FormType? = null, classes: Set<String> = setOf(), init: FormPanel<K>.() -> Unit = null): FormPanel<K>
DSL builder extension function. |