22
Views
3
Comments
Validation

Hello Team,

For mandatory field i have added Form1.Valid validation.

When saving, we should validate if the fields being saved are correctly filled with the right data type.

If the field is a date, we should validate that it is a date

If the field is numeric, we should validate that it is a number.

and so forth .

The message should be clear, and the save action interrupted, if the field data is a different data type.

For non-mandatory fields the rules should only be applied if the field has information.

Can we do it with exception handling?


Regards,

Gagana

2023-08-28 07-00-10
Paulo Torres
Champion

Hi,

The validation form make these basic validations for you but after you should also validate in the server side as the data can be manipulated or called by API as Outsystems create an API for each server action you use in screen action.

Regards

UserImage.jpg
Supriya Malla

Hi @Gaganashree Lohit,

All the validations you've mentioned are already taken care of by the Form.Valid property in OutSystems.

  • It checks that mandatory fields are filled.

  • It also verifies that the values entered match the expected data types (like Date, Integer, Decimal, etc.), even for non-mandatory fields—but only if the user has entered something in them.

Because of this built-in validation, there's no need to use exception handling for input validation. The form will automatically prevent saving and display appropriate validation messages if any field is invalid. You can also customize these messages for specific fields, if needed. 

And as Paulo mentioned, it's still important to validate the data before saving it to the server

Thanks,

Supriya

2024-10-12 12-11-20
Kerollos Adel
Champion

Hallo @Gaganashree Lohit 

There are multiple approaches that can be used depending on the needs and client requirements. One of the upcoming methods is as follows:

šŸ› ļø Field Validation Each field is checked individually, and based on the result, a corresponding message is added to a list.

āŒ Save Operation Check If the list contains any messages (i.e., validation errors), the save operation will be stopped and not completed.


Validation.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.