Form Field

class FormField(    val fieldName: String,     val view: View,     rules: List<BaseRule>,     val action: (String) -> Unit? = null)

Class for field in the form

Author

Jimly A.

Since

06-Jun-20.

Parameters

fieldName

name of the field, used for getting values

view

the View of field, right now supported view is : EditText, TextInputLayout, Spinner, RadioGroup, and CheckBox

rules

list of rules of for the view

action

custom action to do when field is not validated, nullable

Constructors

Link copied to clipboard
fun FormField(    fieldName: String,     view: View,     rules: List<BaseRule>,     action: (String) -> Unit? = null)

Functions

Link copied to clipboard
fun getValue(): String

Method to get values from View

Link copied to clipboard
fun validate(): Boolean

Validate View's value based on defined rules

Properties

Link copied to clipboard
val action: (String) -> Unit? = null
Link copied to clipboard
val fieldName: String
Link copied to clipboard
var isValidated: Boolean = false

does the form field is validated?

Link copied to clipboard
val view: View

Sources

Link copied to clipboard