I was using the same simple pattern to capture input on my web blocks.

Apparently, when you missed putting entry on a mandatory text field of a text box with input type text, it pops that required field warning but you can type in and try again. However, for text box with input type date, the input_BirthDate stays .Valid = False. So I will need to reset the .Valid = True every 'submit'.

When you use the date type, nulldate is 1900-01-01, is not null, if you validate if your date is not nulldate maybe work.

Hi Juan,

If the variable type is Date, then by default it will give you the date 1900-01-01, since you are validating if it is a nulldate (), it will always say no, because 1900-01- 01 is a valid date. You will have to validate for example if the field is a Date and if the variable is not empty. And so you can do the validation. Now you can also add the validation that the birthday cannot be higher than the current date, depending on the purpose of the application, you can also make validations like: imagine it has to be someone over 18, so the maximum date value will have to be the subtraction between the current date and 18 years.

Did my answer help you?

Regards,
Nuno Verdasca

Juan, then tell me if I could help you with my solution, and if you need more help with something related to this topic.

Best regards,
Nuno Verdasca

Hi,

OutSystems performs built-in validations for mandatory fields and valid data types, when some of this conditions fails the the .Valid will be false. 

One solution will be the text field with the date can't be mandatory.

Best Regards,

Nélio

Hi Guys,

The validation itself was not the problem on this one. What I am trying to say is that the valid and validation message doesn't reset when you submit the form. So I had to assign at the start of the submit function to initialize the values of validationmessage to "" and valid to true.

You don't need to do this on input with type text.

Regards,

JC

Solution

Hello Juan,

I was curious about this, as it doesn't seem correct to me.
I tested on mobile (versions 10 and 11) and on React Web, and everything seems to be working.

I just did a test with what it seemed to me you were doing:

I'm attaching the Mobile version (it is for OS10, if you are using OS11, it will be updated) for you to check, but I am not seeing any obvious error.

For me, everything is working and when I set a NullDate, it warns the problem, when I fix, the error message disappears.

Hipe this can help you.

Cheers.

Solution

P.S: THe file I sent does not have the mandatory set to true, but I tested with it set to True and it worked as expected on the three tests I've done.

I finally found what's causing the behavior. Forgot to tick that built-in validation for this specific block. With this set to blank, the valid property of the widgets does't reinitialize on submit.

Sorry about that.