Native Mobile Is Required (version 7 or lower)

WorkWithPlus for Native Mobile Hierarchical Editor allows defining whether an attribute/variable will be mandatory or not.

The Layout tab of the Edit: Any Platform/Portrait view in WorkWithDevicesProduct shows the ProductName attribute selected in the tree, with the Properties panel on the right highlighting the WorkWithPlus for Native Mobile section, where 'Is required' is set to True inside an orange-boxed area alongside Start column, Start row, Row height, and Column width settings.

When this property is set to “True”, WorkWithPlus for Native Mobile is going to automatically create a Sub called CheckRequired where is verified if every required attribute was fulfilled by the user or not:

The Events tab of the Edit: Any Platform/Portrait view in WorkWithDevicesProduct shows the 'CheckRequired' sub with an arrow pointing to its comment block, which instructs calling this subroutine before saving data. The code checks if ProductName.IsEmpty(), builds a &RequiredMessage, and calls Msg(&RequiredMessage) if fields are missing, all marked as generated by WorkWithPlus for Native Mobile.

Defaults customization

The hierarchical editor's 'Is required' feature can be customized using the following properties in the Settings:

  • Required field default error message: This allows the user to define the error message that will be displayed if the required attribute is empty.
  • Multiple required fields default error message: This allows the user to define the error message that will be displayed if more than one required attributes are empty.
  • Required field invite message: This allows the user to define the required field's invite message.
  • Notify required on value change: This allows the user to define if the required field must be checked on the field's 'ControlValueChanged' event, and how it should notify the user.
    • Toast: A toast notifications is fired
    • Msg: An error message is displayed (pop-up)
    • None: IsRequired is not checked in the 'ControlValueChanged'

These properties will be used as the default text for all the fields in all the panels where the functionality is used. The user will have to perform a manual "apply properties" on each panel to impact any change in the settings.

GeneXus Preferences tree for WorkWithPlusNativeDemo with "WorkWithPlus for Native Mobile" selected, and its Properties Editor section highlighted showing "Required field default error message" 'The field "%1" is required', "Multiple required fields default error message", "Required field invite message" "%1 ***", and "Notify required on value change" "Toast".

Native mobile "New Menu Option" form showing a "Person Name" label above an empty required input field marked with "***", with a yellow arrow pointing to the field.    Native mobile "New Menu Option" form with a dimmed background and a modal error dialog reading 'The field "Person Name" is required' with an OK button, triggered after leaving the required Person Name field empty.

Specific object customization

The "error message" can also be customized manually on each attribute/variable, overriding the value at the settings:

WorkWithPlus Layout and Properties panels for the &PersonName data control on a NewMenuOption view, with Label Caption "Person Name" and the WorkWithPlus for Native Mobile properties "Is required" set to True and "Is required error message" set to 'The field "%1" is required', both highlighted.