I have a boolean flag called IsFieldA, and two string fields FieldA and FieldB.
I would like to do validation on FieldA or FieldB depending on the IsFieldA value. (If IsFieldA is true, then check FieldA only. Otherwise, check FieldB only.)
I tried doing this by removing the generated validation for those two fields, and created a FieldAOrFieldB field that sets / gets the field values depending on the IsFieldA value, and check from there. The form field is bound against this hybrid field.
When I flip the IsFieldA value, I am getting validation failure because it is checking the wrong fields. It is updating the field first and then flipping the IsFieldA value after.
Is there a way to set the order of when the fields get updated? I'd like to update the switch first, and then FieldA or FieldB. Is the update order set by the order it appears in the entity?