Field Validation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kiran83
    New Member
    • Feb 2008
    • 18

    Field Validation

    My Text box can accept all types of data like alphabets,numer ic,special characters ... Should give an error message if space is not a valid value. ... in
    asp.net with c# through javascript.
  • bluefootedpig
    New Member
    • Mar 2008
    • 7

    #2
    Originally posted by kiran83
    My Text box can accept all types of data like alphabets,numer ic,special characters ... Should give an error message if space is not a valid value. ... in
    asp.net with c# through javascript.
    not sure exactly what the question is, but it sounds like it shouldn't accept spaces? there isn't any reason why it shoulnd't. The only thing i can think of is do like an event for the submit that validates that there aren't any spaces, which is just a regular expression.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Originally posted by kiran83
      My Text box can accept all types of data like alphabets,numer ic,special characters ... Should give an error message if space is not a valid value. ... in
      asp.net with c# through javascript.
      First you should do validation in your server side code (check if the string contains spaces). This way if your user is able to get around your JavaScript check then your server side code still won't use the invalid data.

      What have you tried so far for your JavaScript?
      Have you tried using a RegularExpressi oinValidator?


      -Frinny

      Comment

      Working...