From wiki.ginstr.com
(Redirected from Validation)
Jump to: navigation, search

Validation

Validation provides the ability to control input from a user onto the database or to restrict the function of a specific format of data.

For example, validation can be used to restrict GnEditText to accept only numbers where the entry field is used for phone numbers or to limit the length of a validation field etc…

To emphasise validation, the designer is encouraged to add in TextView text that describes input field.

Validators

Validators perform validation on widgets.

Currently supported Validators

To execute a validation on a widget, a validator must be attached to it (validator is an XML attribute).

All validators have two obligatory(*) attributes, name and message.

Widgets can also have multiple validators attached, for example:

<EditText
    android:id="@+id/telNumber"
    android:layout_width="150dp"
    android:layout_height="wrap_content"
    gn:act_validate="[name:RequiredValidator],[message=Telephone number field is required]"
    gn:act_validate="[name:TextValidator],[message=Text validation failed],[inputType=NUMBER],[NUMBERErrMsg=Has to be number]"
    gn:data_field="number"
    gn:data_requet="assets" />

Validation types

Immediate validation

Requires attaching a validator to a widget
Validates fields after entry.

Screen validation

Requires widgets that will be validated to contain immediate validators as well as widget that will complete a whole screen validation to contain screen validation attribute.

Pages in category "Validation"

The following 3 pages are in this category, out of 3 total.