validation for name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Blacky
    New Member
    • Jan 2009
    • 40

    validation for name

    Hi,

    I have a textbox and button in my child page it inherits a master page.the textbox should allow to key in only alphabets,comma ,dot,space,sing le quote. And also consecutive comma dot single quote should not be allowed to key in. first and last character should be alphabets.
    I have a javascript but it does not check for consecutive comma,dot,singl e quote...please help me..
    needed urgently..

    thanks in advance,
    Blacky
  • shaahin
    New Member
    • Jul 2010
    • 11

    #2
    Hi
    Use regular expression.
    Its easy to use and u can define for it custom validating
    but if ur data is sensitive validate it on ur business layer.
    good luck

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      In the JavaScript method that you are using to filter the user's input, you will have to grab the text from the TextBox and check for the cases of consecutive commas, dots, and single quotes. Regular expressions can really help with this but they aren't required (if the last letter in the TextBox is a comma, dot, or single quote, and the current key press is the same then don't allow it, otherwise allow it.)

      Comment

      • Blacky
        New Member
        • Jan 2009
        • 40

        #4
        Originally posted by shaahin
        Hi
        Use regular expression.
        Its easy to use and u can define for it custom validating
        but if ur data is sensitive validate it on ur business layer.
        good luck
        Could you please tell me the regular expression that validates my requirements

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          @Blacky, I know your clever enough to figure this out for yourself you have the right tools. I use this Regular Expressions Reference and this Regular Expressions Tester whenever I have to use JavaScript Regexs.

          -Frinny

          Comment

          Working...