From wiki.ginstr.com
Jump to: navigation, search

gn:act_validators

Description
Action used to enable or disable xml defined validators on widgets.
Action returns
void

Action signatures

[gn:act_validators]|[action;validatorTypes{n};targets{n}]
Parameter Description
action Action which will be taken on targeted validators.
  • Can be:
    • enable - enables validator
    • disable - disables validator
validatorTypes{n} (optional) Specific validators to target on certain widget or widgets if there are multiple defined.
targets{n} target target or targets to which action will be applied.
  • Valid target:
    • any widget that has validator in xml defined

Example

initial state

validators on widgets "@+id/bebraObjekte_ObjektNummer" and "@+id/bebraObjekte_ObjektVerwalter" will be loaded on screen load.

screen.xml
<FrameLayout
    android:id="@+id/exampleFrame"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
    gn:act_set="[gn:act_validators]|[disable;;@+id/bebraObjekte_ObjektNummer,@+id/bebraObjekte_ObjektVerwalter]" />

<com.ginstr.widgets.GnEditText
    android:id="@+id/bebraObjekte_ObjektNummer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    gn:act_validate="[name:RequiredValidator],[message=@string/addObject_numberRequiredValidatorMessage]"/>

<com.ginstr.widgets.GnEditText
    android:id="@+id/bebraObjekte_ObjektVerwalter"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    gn:act_validate="[name:RequiredValidator],[message=@string/addObject_managerRequiredValidatorMessage]"/>		
after action execution

Once FrameLayout "@+id/exampleFrame" "gn:act_set" is exectued all validators on widgets "@+id/bebraObjekte_ObjektNummer" and "@+id/bebraObjekte_ObjektVerwalter" will be disabled