I have what I'd think is a common issue but an entire day of googling hasn't turned up anything useful.
I have a form with a checkbox and a textfield. I'd like to do a regex validation of the textfield, but only if the checkbox is selected. Regex validation is currently working for other non-conditional fields but I can't for the life of me figure out if there is a syntax that allows for this in the action-validation.xml file. ie. I have something like below for other fields. What I need is a way of making this conditionaly evaluated only if the checkbox is selected.
<validators>
<field name="sn">
<field-validator type="regex" >
<param name="expression">
[0-9]{12}
</param>
<message>Serial number format is invalid. Please try again</message>
</field-validator>
</field>
</validators>
Does anyone have a code example of how to do this?
Any help is much appreciated.