Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Australian License Number Validation

Australian License Number Validation

Scheduled Pinned Locked Moved ASP.NET
javascriptquestion
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Thats Aragon
    wrote on last edited by
    #1

    Hi All! I have to put a validation for Australian License Number.It's required format is as per below. Validation Maximum length of 9 characters. Alphanumeric characters only. Must have at least 4 numeric characters. Must have no more than 2 alphabetic characters. The third and fourth characters must be numeric. can anyone please suggest any custom validation or javascript ? Thank you, Regards..

    "Save water,It's precious" :) "Don't forget to vote" ;) ;P ;)

    C 1 Reply Last reply
    0
    • T Thats Aragon

      Hi All! I have to put a validation for Australian License Number.It's required format is as per below. Validation Maximum length of 9 characters. Alphanumeric characters only. Must have at least 4 numeric characters. Must have no more than 2 alphabetic characters. The third and fourth characters must be numeric. can anyone please suggest any custom validation or javascript ? Thank you, Regards..

      "Save water,It's precious" :) "Don't forget to vote" ;) ;P ;)

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Sounds like a regular expression to me.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      T 1 Reply Last reply
      0
      • C Christian Graus

        Sounds like a regular expression to me.

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        T Offline
        T Offline
        Thats Aragon
        wrote on last edited by
        #3

        Yes,it can be anything.It may be a regular expression or custom validator or javascript. Thanks for the response. Regards.

        "Save water,It's precious" :) "Don't forget to vote" ;) ;P ;)

        C 1 Reply Last reply
        0
        • T Thats Aragon

          Yes,it can be anything.It may be a regular expression or custom validator or javascript. Thanks for the response. Regards.

          "Save water,It's precious" :) "Don't forget to vote" ;) ;P ;)

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Yeah, it COULD be any of those things, but I imagine that a regex is the most logical. expresso is a great tool if you need help working out a regex.

          Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          T 1 Reply Last reply
          0
          • C Christian Graus

            Yeah, it COULD be any of those things, but I imagine that a regex is the most logical. expresso is a great tool if you need help working out a regex.

            Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

            T Offline
            T Offline
            Thats Aragon
            wrote on last edited by
            #5

            Hi Chris, Thanks for the quick response. I have tried "Expresso".But I can't get the rid of it. Regards.

            "Save water,It's precious" :) "Don't forget to vote" ;) ;P ;)

            V 1 Reply Last reply
            0
            • T Thats Aragon

              Hi Chris, Thanks for the quick response. I have tried "Expresso".But I can't get the rid of it. Regards.

              "Save water,It's precious" :) "Don't forget to vote" ;) ;P ;)

              V Offline
              V Offline
              Vasudevan Deepak Kumar
              wrote on last edited by
              #6

              Cosmo Thought wrote:

              Expresso

              Try it here: www.codeproject.com/KB/dotnet/expresso.aspx[^]

              Vasudevan Deepak Kumar Personal Homepage
              Tech Gossips
              A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

              T 1 Reply Last reply
              0
              • V Vasudevan Deepak Kumar

                Cosmo Thought wrote:

                Expresso

                Try it here: www.codeproject.com/KB/dotnet/expresso.aspx[^]

                Vasudevan Deepak Kumar Personal Homepage
                Tech Gossips
                A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

                T Offline
                T Offline
                Thats Aragon
                wrote on last edited by
                #7

                Hi Vasudevan Deepak Kumar, Thanks for response. I have "Expresso". I have tried this. But I can't figure out the correct expression. I can't make expression with numeric and alphabetic. somewhere I am wrong. I am still playing with "Expresso".....:confused:

                "Save water,It's precious" :) "Don't forget to vote" ;) ;P ;)

                G 1 Reply Last reply
                0
                • T Thats Aragon

                  Hi Vasudevan Deepak Kumar, Thanks for response. I have "Expresso". I have tried this. But I can't figure out the correct expression. I can't make expression with numeric and alphabetic. somewhere I am wrong. I am still playing with "Expresso".....:confused:

                  "Save water,It's precious" :) "Don't forget to vote" ;) ;P ;)

                  G Offline
                  G Offline
                  Gandalf_TheWhite
                  wrote on last edited by
                  #8

                  U can try out for Javascript posted below Expresso cannot work for the expressions like this. That becomes tough for Expresso. Try this.. put the code in ur jscript function nx(obj) { var str = document.getElementById(obj).value; if(str.length > 3 && str.length < 10) { if((str.charCodeAt(2) > 47 && str.charCodeAt(2) < 58) && (str.charCodeAt(3) > 47 && str.charCodeAt(3) < 58)) { var c = 0; var n = 0; for(i = 0 ; i < str.length ; i++) { if(str.charCodeAt(i) > 47 && str.charCodeAt(i) < 58) { n++ } else { c++ } } if(n < 4 && c > 2) { return false } else { return true; } } else { return false; } } else { return false; } return false; } The ASCII part is very Improtent to do the task. I hope that will help If work let me know. :)

                  Believe Yourself™ :-\™

                  T 1 Reply Last reply
                  0
                  • G Gandalf_TheWhite

                    U can try out for Javascript posted below Expresso cannot work for the expressions like this. That becomes tough for Expresso. Try this.. put the code in ur jscript function nx(obj) { var str = document.getElementById(obj).value; if(str.length > 3 && str.length < 10) { if((str.charCodeAt(2) > 47 && str.charCodeAt(2) < 58) && (str.charCodeAt(3) > 47 && str.charCodeAt(3) < 58)) { var c = 0; var n = 0; for(i = 0 ; i < str.length ; i++) { if(str.charCodeAt(i) > 47 && str.charCodeAt(i) < 58) { n++ } else { c++ } } if(n < 4 && c > 2) { return false } else { return true; } } else { return false; } } else { return false; } return false; } The ASCII part is very Improtent to do the task. I hope that will help If work let me know. :)

                    Believe Yourself™ :-\™

                    T Offline
                    T Offline
                    Thats Aragon
                    wrote on last edited by
                    #9

                    Hi Gandalf! Thanks for the reply. I have done it with different method.:cool: Thank you again.. Regards.

                    "Save water,It's precious" :) "Don't forget to vote" ;) ;P ;)

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups