3 Replies Latest reply on Nov 4, 2010 5:46 AM by Ned Murphy

    Minimum number of characters+numbers

    Ron Colmen Level 2

      In my registration form I've got a text box to enter a password.

      How do I make this Dynamic text box have a minimum of 6 characters, numbers or both (totals 6).

        • 1. Re: Minimum number of characters+numbers
          Ned Murphy Adobe Community Professional & MVP

          If you mean how do you check if it has 6 or more, then test the Textfield.length property.

          1 person found this helpful
          • 2. Re: Minimum number of characters+numbers
            Ron Colmen Level 2

            Thanks Ned!

             

            Also how do I make sure that the user enters a password which contains both characters and numbers?

            • 3. Re: Minimum number of characters+numbers
              Ned Murphy Adobe Community Professional & MVP

              That you'll have to do a little work to figure out.  For me to hand you a solution would require me doing what you'll have to do since I don't have it readily available.  And I prefer not to do that in any case. I like to help people figure out how to solve their own, not do it for them (I do that for a living). You might find someone else offering a solution here or if you search Google using "AS2 alphanumeric" or similar terms.

               

              The basics of the process involve going thru each character in the password String and testing if it is a number or a letter (a character can be either), and keeping tallies of both as you go.  When you get to the end you test if both tallies are > 0 and sum to the length of the String.  You could stop as soon as you detect both > 0, but it's best to go thru the whole String to make sure only allowed characters are used.

               

              For one approach, some useful things would be the String class and its toLowerCase() and charCodeAt() methods.

              1 person found this helpful