Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8360663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:31:21+00:00 2026-06-09T11:31:21+00:00

Is there a compare validator in Flex? I searched but couldn’t able to find

  • 0

Is there a compare validator in Flex? I searched but couldn’t able to find it. Is there any validator like compare validator ?

My example is how to check whether the password and confirm password is same using flex validator

<s:TextInput id="password" width="218" textAlign="left" contentBackgroundColor="#FFFFFF"/>
<s:TextInput id="confirmpassword" width="218" textAlign="left" contentBackgroundColor="#FFFFFF"/> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:31:22+00:00Added an answer on June 9, 2026 at 11:31 am

    Having the following 2 email fields, for first we define a standard email validator and for the confirmation we define a custom email validator attached at the end of the answer.

    <mx:HBox
        verticalAlign   = "middle"
        color           = "#101010">
        <mx:Label
            text        = "E-Mail Address:"
            width       = "120"/>
        <mx:TextInput
            id          = "txtEmail"
            width       = "220"/>
    </mx:HBox>
    <mx:HBox
        verticalAlign   = "middle"
        color           = "#101010">
        <mx:Text
            text        = "Rewrite E-Mail Address:"
            width       = "120"/>
        <mx:TextInput
            id          = "txtEmail2"
            width       = "220"/>
    </mx:HBox> 
    

    Now we add the validators

    <mx:EmailValidator
        id              = "valEmail"
        required        = "true"
        source          = "{txtEmail}"
        property        = "text"
        invalidCharError            = "Invalid format"
        invalidDomainError          = "Invalid format"
        invalidIPDomainError        = "Invalid format"
        invalidPeriodsInDomainError = "Invalid format"
        missingAtSignError          = "Invalid format"
        missingPeriodInDomainError  = "Invalid format"
        missingUsernameError        = "Invalid format"
        />
    
    <validators:EmailConfirmationValidator
        id              = "valEmail2"
        required        = "true"
        source          = "{txtEmail2}"
        property        = "text"
        confirmationSource  = "{txtEmail}"
        confirmationProperty= "text"/>
    

    And separately we need to define the EmailConfirmationValidator class which I have declared inside a “validators” package

    package validators
    {
    import mx.validators.ValidationResult;
    import mx.validators.Validator;
    
    public class EmailConfirmationValidator extends Validator
    {
        public var confirmationSource: Object;
        public var confirmationProperty: String;
    
        public function EmailConfirmationValidator()
        {
            super();
        }
    
        // Define the doValidation() method.
        override protected function doValidation(value:Object):Array 
        {
            // Call base class doValidation().
            var results:Array = super.doValidation(value);
    
            if (value.text != value.confirmation)
            {
                results.push(new ValidationResult(true, null, "Mismatch",
                    "Emails do not match!"));
            }
    
            return results;
        }       
    
        /**
         *  @private
         *  Grabs the data for the confirmation password from its different sources
         *  if its there and bundles it to be processed by the doValidation routine.
         */
        override protected function getValueFromSource():Object
        {
            var value:Object = {};
    
            value.text = super.getValueFromSource();
    
            if (confirmationSource && confirmationProperty)
            {
                value.confirmation = confirmationSource[confirmationProperty];
            }
    
            return  value;
        }  
    
    
    }
    }
    

    In case you need to manually check the validators in your form. For example when before submitting the content for registration, use the following method

    public function isValid():Boolean
    {
    var validators:Array            = [valEmail, valEmail2];
        var validatorErrorArray:Array   = Validator.validateAll(validators);;
    var isValidForm:Boolean         = validatorErrorArray.length == 0;
    
        return isValidForm;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any fast algorithm that allows to compare two files (for verification purpose)
is there a way l can compare two columns | fields in django like
there are two databases to compare,but I can't connect one database directly. so I
I'm wondering whether there is a way to find out whether a class is
I want to create a custom Data annotation Validator to check whether all the
hi im have a very common problem but unable to find any answer i
In Mysql there is a compare operator that is a null safe: <=>. I
I know that on MacOSX / PosiX systems, there is atomic-compare-and-swap for C/C++ code
Is there a program to compare one folder and all subfolders to another folder
Is there a way to compare 2 shelves in TFS without having to resort

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.