10 Replies Latest reply on Aug 25, 2006 4:35 PM by Newsgroup_User

    Phone Number Vaildation

    burritobot
      Anyone have a function that checks for phone number input errors?

      Something like:



        • 1. Re: Phone Number Vaildation
          Level 7
          burritobot,

          > Anyone have a function that checks for phone
          > number input errors?

          I don't know about "have a function," but I'll be happy to help you
          write a function -- that's even better, because once you know how, you'll be
          able to use your skill again for other purposes in the future. :)

          > If (number is less or more than 10 digits){
          > giveError();

          It's easiest with numbers, I think -- but before we begin ... is the
          phone number, as entered by the user, a number, or a string? If it has
          numerals only, it might be a number. If not -- if, for instance, it also
          includes hyphens or other characters -- it would be a string and would have
          to be converted. Have you gotten this far yet, or would we have to start
          from here?


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Phone Number Vaildation
            Level 7
            i would try with something like this

            // first of all, you have to be sure that there are only numbers in the
            variable, thats easy:

            name_of_the_variable.restrict = "0-9";

            // the only things that you can insert are numbers from 0 to 9

            // then you have the IF statement:

            if (name_of_the_variable.length == 10 && name_of_the_variable.substr(0, 1)
            != "0" && name_of_the_variable.substr(0, 1) != "1") {
            trace("ok");
            } else {
            trace("noooop");
            }

            /*
            you can see that you have an IF with 3 conditions, and because the operators
            are AND (&&) the 3 have to be true
            - name_of_the_variable.length == 10 //// number is less or more than 10
            digits
            - name_of_the_variable.substr(0, 1) != "0" //// you select the first
            number and check that this number is not (!=) 0
            - name_of_the_variable.substr(0, 1) != "1" //// you select the first
            number and check that this number is not (!=) 1
            */

            there are many ways to do it (as much as programers)

            i hope this help you, and that you can learn how to think it





            "burritobot" <webforumsuser@macromedia.com> escribi� en el mensaje
            news:ebvsud$ms5$1@forums.macromedia.com...
            > Anyone have a function that checks for phone number input errors?
            >
            > Something like:
            >
            >
            >
            >
            >
            > If (number is less or more than 10 digits){
            > giveError();
            > } else if (number contains erroneous characters){
            > give Error();
            > }else if (number starts with 0 or 1){
            > give Error();
            > }
            >


            • 3. Re: Phone Number Vaildation
              Level 7
              > // first of all, you have to be sure that there are only
              > numbers in the variable, thats easy:
              >
              > name_of_the_variable.restrict = "0-9";

              This is a good idea. This restricts text entry into TextField,
              TextArea, and TextInput instances. Unfortunately, the OP didn't mention
              anything about *how* this information is being gathered -- perhaps from some
              external source (PHP, etc.)? -- so it may be moot. But good thinking.

              I'm surprised he or she hasn't come back.


              David Stiller
              Adobe Community Expert
              Dev blog, http://www.quip.net/blog/
              "Luck is the residue of good design."


              • 4. Re: Phone Number Vaildation
                Level 7
                david,

                i really liked your blog

                i'll be glad (if you want) to contribute to it in what i can

                regards

                Juan Ignacio Caffini
                www.caffini.com.ar

                "David Stiller" <stiller-NO-SPAM-@quip.net> escribi� en el mensaje
                news:ecl3lq$7u0$1@forums.macromedia.com...
                >> // first of all, you have to be sure that there are only
                >> numbers in the variable, thats easy:
                >>
                >> name_of_the_variable.restrict = "0-9";
                >
                > This is a good idea. This restricts text entry into TextField,
                > TextArea, and TextInput instances. Unfortunately, the OP didn't mention
                > anything about *how* this information is being gathered -- perhaps from
                > some external source (PHP, etc.)? -- so it may be moot. But good
                > thinking.
                >
                > I'm surprised he or she hasn't come back.
                >
                >
                > David Stiller
                > Adobe Community Expert
                > Dev blog, http://www.quip.net/blog/
                > "Luck is the residue of good design."
                >


                • 5. Re: Phone Number Vaildation
                  Level 7
                  Juan,

                  > i really liked your blog

                  Thanks!

                  > i'll be glad (if you want) to contribute to it in what i can

                  WordPress does allow for multiple authors, but I hadn't given it much
                  thought. For the time being, I'm comfortable being the sole author, but I'm
                  always happy to see comments.

                  I think your http://www.mocean.tv/ interface is terrific! Reminds me of
                  old Myst or some of the later Zork entries. Beautiful artwork!


                  David Stiller
                  Adobe Community Expert
                  Dev blog, http://www.quip.net/blog/
                  "Luck is the residue of good design."


                  • 6. Re: Phone Number Vaildation
                    Level 7
                    Juan,

                    > i really liked your blog

                    Thanks!

                    > i'll be glad (if you want) to contribute to it in what i can

                    WordPress does allow for multiple authors, but I hadn't given it much
                    thought. For the time being, I'm comfortable being the sole author, but I'm
                    always happy to see comments.

                    I think your http://www.mocean.tv/ interface is terrific! Reminds me of
                    old Myst or some of the later Zork entries. Beautiful artwork!


                    David Stiller
                    Adobe Community Expert
                    Dev blog, http://www.quip.net/blog/
                    "Luck is the residue of good design."


                    • 7. Re: Phone Number Vaildation
                      Level 7
                      Juan,

                      > i really liked your blog

                      Thanks!

                      > i'll be glad (if you want) to contribute to it in what i can

                      WordPress does allow for multiple authors, but I hadn't given it much
                      thought. For the time being, I'm comfortable being the sole author, but I'm
                      always happy to see comments.

                      I think your http://www.mocean.tv/ interface is terrific! Reminds me of
                      old Myst or some of the later Zork entries. Beautiful artwork!


                      David Stiller
                      Adobe Community Expert
                      Dev blog, http://www.quip.net/blog/
                      "Luck is the residue of good design."


                      • 8. Re: Phone Number Vaildation
                        Level 7
                        Juan,

                        > i really liked your blog

                        Thanks!

                        > i'll be glad (if you want) to contribute to it in what i can

                        WordPress does allow for multiple authors, but I hadn't given it much
                        thought. For the time being, I'm comfortable being the sole author, but I'm
                        always happy to see comments.

                        I think your http://www.mocean.tv/ interface is terrific! Reminds me of
                        old Myst or some of the later Zork entries. Beautiful artwork!


                        David Stiller
                        Adobe Community Expert
                        Dev blog, http://www.quip.net/blog/
                        "Luck is the residue of good design."


                        • 9. Re: Phone Number Vaildation
                          Level 7
                          Juan,

                          > i really liked your blog

                          Thanks!

                          > i'll be glad (if you want) to contribute to it in what i can

                          WordPress does allow for multiple authors, but I hadn't given it much
                          thought. For the time being, I'm comfortable being the sole author, but I'm
                          always happy to see comments.

                          I think your http://www.mocean.tv/ interface is terrific! Reminds me of
                          old Myst or some of the later Zork entries. Beautiful artwork!


                          David Stiller
                          Adobe Community Expert
                          Dev blog, http://www.quip.net/blog/
                          "Luck is the residue of good design."


                          • 10. Re: Phone Number Vaildation
                            Level 7
                            Juan,

                            > i really liked your blog

                            Thanks!

                            > i'll be glad (if you want) to contribute to it in what i can

                            WordPress does allow for multiple authors, but I hadn't given it much
                            thought. For the time being, I'm comfortable being the sole author, but I'm
                            always happy to see comments.

                            I think your http://www.mocean.tv/ interface is terrific! Reminds me of
                            old Myst or some of the later Zork entries. Beautiful artwork!


                            David Stiller
                            Adobe Community Expert
                            Dev blog, http://www.quip.net/blog/
                            "Luck is the residue of good design."