0
votes

I would like to attach an error to a formItem. In spark, it appears that the standard way it is rendering on error on validation of a textInput, is bordering the textInput with red, placing a yellow alert icon next to the textInput and placing the error message in the formItem aligned to the right.

How does one do this manually for a custom formItem invalidation so that I can conform to error display?

1
I don't understand what you're trying to achieve. - RIAstar
Lets say you have set of custom components in a formItem. The set of custom components is invalid. How does one attach an error to the formItem that conforms to the spark way of displaying errors as described above? I have a group of radioButtons that I want to make required or for example a group of checkboxes that I want to make required. Setting errorString doesn't do anything. - MetaChrome
Is there anything stopping you from setting errorString on each of the checkboxes or radioButtons? - Wesley Petrowski
Setting errorString on a RadioButton doesn't do anything. And it is incorrect and ugly to set an error on every radioButton or component of an invalid group. Either way, I would expect this to a very known piece of as it is required for writing any custom form components or validators. - MetaChrome
Setting errorString on a RadioButton works for me - it changes the borderColor and an error message appears on hover. I'm just trying to understand what it is you want to have happen. Do you want a red border to appear around the entire FormItem? And the error message to appear... where? Any time you hover over the FormItem? - Wesley Petrowski

1 Answers

1
votes

Setting errorString on a FormItem will cause the error tooltip to appear when you hover over the FormItem.

<mx:FormItem label="Pick some numbers!" x="10" y="10" errorString="Error!">
  <mx:CheckBox label="One"/>
  <mx:CheckBox label="Two"/>
  <mx:CheckBox label="Three"/>
</mx:FormItem>

No hover:

enter image description here

Hover:

enter image description here