Matt, Thank you for you reply. Yes, the valiadator does fire, and if I mouse over the box and it is not checked, the error displays and then disappears when I mouse back out. However if I check the box, the error does not go away.
Thanks, Sean --- In flexcoders@yahoogroups.com, "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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of im_sean_s > Sent: Friday, December 02, 2005 1:27 PM > To: flexcoders@yahoogroups.com > 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 --------------------~--> 1.2 million kids a year are victims of human trafficking. Stop slavery. http://us.click.yahoo.com/WpTY2A/izNLAA/yQLSAA/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/