16
Views
3
Comments
How to access default validation messages defined centrally in module's properties?

I have scenario where I have an input field A that is not required. However, depending on other fields B and C, this field A should be required. So to achieve this, when form is submitted I'm setting A field's Valid prop to false, but  for Message prop of that widget I need to pass default required field error message that is defined in a Module props.

Is this possible or I have to create a copy of that error text again in my block?

Champion
Rank: #371

Hi, friend!

The validation throws an element with the message like below just after the input field:

<span class="validation-message">Required field!</span>

The class that controls the red alert in the field is simple called 'not-valid'.

So, what you can run a javascript inside the validation flow to control the message in the screen. That will look exactly like the original validation message.


Best regards

Rank: #26938

Hi Lenon,

to be more specific, I need access to these properties of a module in a block level:

Rank: #26938

to be more specific, I need access to these properties of a module in a block level: