I have a TextInput control in my form that is required only when a
RadioButtonGroup has a certain selected value. There is a RegExpValidator
defined that is tied to the TextInput source property.
Here's the validator:
<mx:RegExpValidator id="employeeEmailValidator" source="{formEmail}"
property="text" flags="g" expression="{emailRegex}"
noMatchError="Invalid Email Address format"
required="{formNoticesGroup.selectedValue == 'yes'}"/>
With the radio button set so that the field is required, I can focus in and
then focus out of the TextInput and I get the red box border. But if I go
change the radio button selection so that the field isn't required, the red box
remains and I still see the toolTip indicating that the field is required.
It's not until I focus in and focus out of the TextInput again that I see that
styling go away.
I tried putting the following into the RadioButton definition:
change="{employeeEmailValidator.validate();}" but it didn't seem to help.
I would think that binding the required property of the RegExpValidator would
be enough, but it's not changing the apparent required indicator until the
TextInput gains and loses focus (which I assume triggers the default
valueCommit event).
Any thoughts on what I can do? When I save the form the validator works OK and
I don't have any issues if it isn't required, but the user is still going to
get confused when filling out the form.