Expand my Community achievements bar.

Conditional required field.

Avatar

Level 1

Hello,

I've to make a field REQUIRED depending on the value of another radio button.

I've created a servervalidation.jsp for the Constraint and set this one on the field. The problem is that if a remove the REQUIRED flag from the field, and I write nothing in the field, the servervalidation is not called.

If I check the required flag it will test the field value independently from the radio button value, so it stops before my servervalidation logic.

So:
field component required flag: checked
field component contraint: my contraint
result: stops on empty field value before my contraint logic

field compoenent required flag: unchecked
field component contraint: my contraint
result: read my contraint logic ONLY if a value is written (not in the case the field is empty)

Is there a way to rewrite REQUIRED logic in a conditional way?

Thanks

0 Replies