SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Non-Member
    Join Date
    Sep 2013
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can I check a value entered in a field on my form is a number?

    How can I check a value entered in a field on my form is a number?

  2. #2
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,435
    Mentioned
    82 Post(s)
    Tagged
    3 Thread(s)
    You can do it client side with JavaScript or server side with php etc.

    Are you using php, ASP etc. with your code or just HTML?

  3. #3
    Non-Member
    Join Date
    Sep 2013
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I make a website field mandatory?

    How do I make a website field mandatory?

  4. #4
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,435
    Mentioned
    82 Post(s)
    Tagged
    3 Thread(s)
    As I posted on your earlier thread it depends on how you are coding your site - you need to put more information into your posts if you want a useful reply.

  5. #5
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,658
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    The best way is to make it mandatory with both JS client side and php server side. If you need code help then give a bit more info as to your requirements.

  6. #6
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,529
    Mentioned
    182 Post(s)
    Tagged
    6 Thread(s)
    Threads merged as they seem to be related but will both require the same information supplied anyway.

  7. #7
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,821
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    in HTML5 you can do type='number' in an input tag, keeping in mind not all browsers support html5, and form validation is VITAL

    you can ad javascriptt fall backs,

    but the SAFEST way is to check your data server side, if when the data is received and checks it is valid then you redirect the user to a new page.. other wise you redisplay the form.

    How you do his last part sever side will vary depending upon which server side language you are using.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •