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,null);
                }
                
                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}</DonationConfirmation>
</mx:Model>

<customValidators:CheckboxRequiredValidator
field="fieldValues.DonationConfirmation" required="true"/>

<mx:CheckBox id="DonationConfirmation" labelPlacement="right"
selected="{formModel.DonationConfirmation}"/>









------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/KIlPFB/vlQLAA/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/
 


Reply via email to