Apply not-valid class without setting validation message
Question

OS11 Reactive Web

I have a form with two checkboxes. One option or both must be selected, but leaving neither selected would be invalid.

If the user clicks 'OK' with neither box checked, I want to set 'valid' of each checkbox to false. I do not want to set a validation message, I simply want Valid to be false (I have over-ridden the not-valid styles that will be applied to make the border of the checkbox itself red.)

When I use an assign statement to set the Valid property of the checkbox to false without setting any ValidationMessage, the class not-valid is not applied to the field. If I set Valid to false and make the Validation Message "" (empty quotes) the class not-valid is not applied. If I set a ValidationMessage, the class not-valid is applied to the checkbox, but this is not what I want.

How can I apply the not-valid class without setting a ValidationMessage?

Thank you very much.

Solution

Hello Landon,

You has two options to do what do you want.

You can add class with a simple JS like this :


Or you can too put a Validation message with an space like this 

Regards, James


James Andrade wrote:

Hello Landon,

You has two options to do what do you want.

You can add class with a simple JS like this :


Or you can too put a Validation message with an space like this 

Regards, James



Thanks! I feel silly for not considering either of those options on my own.

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