In addition to what Matt has said: it depends on when you're firing your validator.
in MXML do validation on user event: <mx:CheckBox click="myValidation()" .../> -or- <mx:CheckBox buttonDown="myValidation()" .../> If you're doing it programmatically in AS, you can add an event listener for mouse events for this target. myCheckBox.addEventListener(MouseEvent:MOUSE_UP,myValidation); Either way should give you real-time error checking. Good Luck --- In [email protected], "Matt Chotin" <[EMAIL PROTECTED]> wrote: > > Does the validator fire when you check the checkbox and it's just that > the error doesn't clear? Or does the validator not fire when you click > on the checkbox? > > > > If the first it sounds like a bug, you could workaround it by adding a > validate handler and setting the errorString on the checkbox to null if > there are no errors. > > > > <customValidators:CheckboxRequiredValidator > field="fieldValues.DonationConfirmation" required="true" validate="if > (!event.validator.hasErrors()) DonationConfirmation.errorString = > null;"/> > > > > I think that the Checkbox does clear its error messages though so I'd > make sure that your validator is really firing and doing the right > thing. > > > > Matt > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of im_sean_s > Sent: Friday, December 02, 2005 1:27 PM > To: [email protected] > Subject: [flexcoders] Custom Validator on CheckBox > > > > Hello. I have a form in an application I'm building that requires the > user to check a CheckBox that acknowledges they read a statement. In > order to check that the CheckBox has been checked, I created a custom > validator. The validator works fine, but the problem I have is that > when the user checks the CheckBox, the error message does not go away. > The code for the validator is below. > > Thank you, > Sean > > class CheckboxRequiredValidator extends mx.validators.Validator > { > > public function CheckboxRequiredValidator() > { > > } > > public function doValidation(checkboxValue):Void > { > > CheckboxRequiredValidator.validateCheckbox(this,checkboxValue,required,n > ull); > } > > public static function > validateCheckbox(validator:mx.validators.Validator, > > checkboxValue, required, subfield):Boolean > { > if ( required && !Boolean(checkboxValue)) > { > validator.validationError("notCheckedError", > "This checkbox must > be checked.", subfield); > return false; > } > return true; > } > } > ------------------------------------------------------------------------ > ---- > <mx:Model id="fieldValues"> > <DonationConfirmation>{DonationConfirmation.selected}</DonationConfirmat > ion> > </mx:Model> > > <customValidators:CheckboxRequiredValidator > field="fieldValues.DonationConfirmation" required="true"/> > > <mx:CheckBox id="DonationConfirmation" labelPlacement="right" > selected="{formModel.DonationConfirmation}"/> > > > > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.com > > > > > ________________________________ > > YAHOO! GROUPS LINKS > > > > * Visit your group "flexcoders > <http://groups.yahoo.com/group/flexcoders> " on the web. > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of > Service <http://docs.yahoo.com/info/terms/> . > > > > ________________________________ > ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/2jUsvC/tzNLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

