Hello Salini,
There's an easier and more direct way of doing this validation, that I think matches exactly what you need. Please see the following two videos from the online training:
In the button that you're using to submit the inputs of the form, you need to change the property Validation to "Client & Server".
Then, in the action associated with the button, you can check the value that the user entered in the input, perform your validations, and if the value is invalid you assign <Input>.Valid = True and <Input>.Message = <Your custom message>.
Finally, at the end of all your validations, you just need to check if <Form>.Valid is True or False. If it is False, you end your action there (meaning that the application does not advance to another screen). Your custom message is displayed next to the invalid input.
There's an easier and more direct way of doing this validation, that I think matches exactly what you need. Please see the following two videos from the online training:
- http://www.outsystems.com/academy/training/13/1707/691/add-custom-server-side-validations/
- http://www.outsystems.com/academy/training/13/1707/692/client-side-validation-of-inputs/
In the button that you're using to submit the inputs of the form, you need to change the property Validation to "Client & Server".
Then, in the action associated with the button, you can check the value that the user entered in the input, perform your validations, and if the value is invalid you assign <Input>.Valid = True and <Input>.Message = <Your custom message>.
Finally, at the end of all your validations, you just need to check if <Form>.Valid is True or False. If it is False, you end your action there (meaning that the application does not advance to another screen). Your custom message is displayed next to the invalid input.