19
Views
10
Comments
catch validation submit

i have a block with textbox.

i need to validate it with custom function.

how i can understand when submit fires validation?

2016-04-22 00-29-45
Nuno Reis
 
MVP

Hello.
Your question isn't very clear.

My first question would be which OutSystems version? This sounds like a Traditional question. The best path is for you to ignore custom validations and do them all inside the action.

If in Reactive/ODC, you must do custom validations before the standard If(Form.Valid) so that any <Widget>.Valid you change to false is considered in that final If.

https://learn.outsystems.com/training/journeys/web-developer-662/demo-how-to-define-custom-form-validations/o11/230


UserImage.jpg
emanuele mantovanelli

thank you for answer.

clear, but i would color red only when submit is fired.

changing validation before, color change before submit.

how i can undestand when submit is fired?

2016-04-22 00-29-45
Nuno Reis
 
MVP

Luckily for you, that was part of my class yesterday :)

You have widgets on the form. Each widget has two properties: Valid (boolean) and Validation Message (text).

Imagine you have an Input widget for the Name variable called Input_Name.

If you think the text must more than 10 characters long, you can make that condition in a If.

Length(Name) >10

When it fails you set the widget's Valid to False and the form you flag the input in red like you wanted. That alone will also make Form.Valid to be invalid and exit the flow on the standard If.

You should also change the Input_Name.ValidationMessage so the input widget besides being red gets a custom message on why it is wrong.

UserImage.jpg
emanuele mantovanelli

yes, it's very clear and i already do it.

but i want to show invalid colors only when i click submit.

in this way textbox is red after i wrote. or i forget something?

2025-08-07 06-30-56
Amit J
Champion

Instead of catching validation you can add you custom validation in submit button click events whatever validation you wan.

Inbuilt validation work base on empty or  data type.

If you don't want them then turn off inbuilt validation. And. Add you custom validation on submit click event after just start.


UserImage.jpg
emanuele mantovanelli

each block has trigger and it's too easy and clear check there validity.

lot of checks are very complex.


2016-04-22 00-29-45
Nuno Reis
 
MVP

There is a course for Development in Outsystems. It includes that subject.

I gave you the link for that part, but you should also see the rest to understand how it works.

UserImage.jpg
emanuele mantovanelli

thank you.

i didn't think was too difficult to do it.

UserImage.jpg
emanuele mantovanelli

but...i'm working in block.

validation is done before submit and i want show error after.

try to check my OML.

validation of block after submit.oml
2016-04-22 00-29-45
Nuno Reis
 
MVP

You are thinking in Validation and Error Message as the same thing.

Validation is done when the action runs (it can be triggered in a onChange to test every change, or only on submit, or never).

The error is shown when you set the Valid property to False.

You choose when they happen.

But until you explain exactly what is happening or share the oml, it is hard to help.

but i want to show invalid colors only when i click submit. In this way textbox is red after i wrote. or i forget something?

The box is only red if you are doing validation onChange. Place the validation on Submit.

Unless you mean that after the first submit the box stays red until you submit again. In that case you can change Valid to True onChange and it will lose the red until you submit again.



EDIT: looking at the oml, you are calling the event even when the validation fails. That is probably not what you want.

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