I have a form which contains a select & text input in a row. The children of this row is being repeated using server connect. And, based on the value in each row of server connect, text input or select get shown in the UI.
So a form with dynamic number and type of elements. This works great.
Now, I need to bind a custom message for required validation. I can set whether the field is required or not using dynamic attributes, but I don’t see dynamic options for validation rules.
I tried setting value for required as
dmx-bind:data-msg-required="validation_message" (where validation_message is a field), but its not working correctly.
All messages are shown under first row always. And are overlapped from last to first. So only last message is visible.
Also, I need to set the regex pattern validation’s value dynamically. I can do it with
dmx-bind:data-rule-pattern="validation", but again, the message is not working.
Is using code behind the best option for applying dynamic validation constraints? And how to set dynamic validation messages?