Data Validation

  

Hi

Just have a small question on the data validation in Outsystems.

we've a form which is being used to display the data from the database. if i delete the data from some fields and am using INPUT_FOCUSFIRSTINVALID richwidget, the system is not doing anything with regards to saving the details to DB, also it is not highlight the first invalid field.  I think this might be because though the user is deleting the data but the widget still have the data in the variable back end and does not think it is invalid and that's why not highlighting the first invalid field.

Vice versa, similar situation however, in this case the user is entering the details on the form however leave some fields empty.  The above widget give a "select data" or "select date" prompt and also set the focus on the first invalid field....


M i correct on this.....


Regards



Sunil Babar

Solution

Hi Sunil,

What happens depends on the type of validation. The Button or Link that triggers the POST of the form data has a Validation Property, that can be Server, Client & Server or (none). If you set it to (none), no validation is performed.

If you set it to Client & Server, before the data is sent to the server, the page will check the validity of the data fields, and if it finds an invalid field will not continue sending the data (so your Screen Action will not be called) and displays the Input Widget's ValidationMessage.

If you set it to Server, no checking is done, as it is supposed to be done explicitly in the Screen Action called when pressing the Button/Link. You check the values yourself, and if they're wrong, set the Widget's Valid property to False, and set an appropriate ValidationMessage to show.

For the Input_FocusFirstInvalid to work, at least one Input Widget must have the Valid Property set to False, otherwise it will not work.

Solution

Kilian Hekhuis wrote:

Hi Sunil,

What happens depends on the type of validation. The Button or Link that triggers the POST of the form data has a Validation Property, that can be Server, Client & Server or (none). If you set it to (none), no validation is performed.

If you set it to Client & Server, before the data is sent to the server, the page will check the validity of the data fields, and if it finds an invalid field will not continue sending the data (so your Screen Action will not be called) and displays the Input Widget's ValidationMessage.

If you set it to Server, no checking is done, as it is supposed to be done explicitly in the Screen Action called when pressing the Button/Link. You check the values yourself, and if they're wrong, set the Widget's Valid property to False, and set an appropriate ValidationMessage to show.

For the Input_FocusFirstInvalid to work, at least one Input Widget must have the Valid Property set to False, otherwise it will not work.


Thanks Kilian! that helps alot.

You're most welcome! Happy coding :).