Non-text field Validation

This is a discussion on "Non-text field Validation" within the JavaScript Forum section. This forum, and the thread "Non-text field Validation are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 23rd, 2006, 16:51
Junior Member
Join Date: Aug 2006
Location: Leeds
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Non-text field Validation

Hi,
I appreciate any feedback on this matter>>

I have created a website for my University course which includes a form. So far I have included JavaScript to validate things such as name and address text field to ensure that something has been entered into them.

However, I need to validate a telephone number and not sure what to do for this or how. I would be grateful if anyone could give me any hints or tips on what is available with JavaScript.

Thanks
Reply With Quote

  #2 (permalink)  
Old Nov 23rd, 2006, 17:30
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Non-text field Validation

This isn't really a JavaScript tip, but you'd be better off using PHP to validate strings. It's much easier and it can't be fooled like JavaScript validation can.
Reply With Quote
  #3 (permalink)  
Old Nov 23rd, 2006, 17:57
Junior Member
Join Date: Aug 2006
Location: Leeds
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Non-text field Validation

The form uses php to provide feedback to the user but I have originally created the form in a html file and used JavaScript with the onSubmit to display alerts and was wanting to keep all the validation within the html form.
Reply With Quote
  #4 (permalink)  
Old Nov 23rd, 2006, 18:15
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Non-text field Validation

Ok, I would suggest at least using a PHP validation behind a JavaScript one. I've done it many times to avoid validation, but all a user has to do is disable JavaScript and the form will go through.
Reply With Quote
  #5 (permalink)  
Old Nov 23rd, 2006, 18:16
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Non-text field Validation

Oh, and:

http://www.google.com/search?q=JavaS...Phone%20Number
Reply With Quote
  #6 (permalink)  
Old Nov 24th, 2006, 12:52
Junior Member
Join Date: Aug 2006
Location: Leeds
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Non-text field Validation

Thanks for your comments, I will have a go at uing PHP as well then. I was looking into that but its just having the time. I think it is worth it though.
Thanks again
Reply With Quote
  #7 (permalink)  
Old Nov 24th, 2006, 22:34
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: Non-text field Validation

In both JavaScript and PHP you need to be looking at Regular Expressions to validate patterns like phone numbers, postcodes, email address, etc.
Reply With Quote
Reply

Tags
form validation

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
making text field text disapear Phixon JavaScript Forum 4 Feb 2nd, 2008 07:49
[SOLVED] Field validation and changing display properties... c_martini JavaScript Forum 12 Sep 25th, 2007 11:27
validate text field to db field jtesolin Classic ASP 1 Jul 18th, 2006 17:48
Number validation in form field Matc JavaScript Forum 2 May 26th, 2006 15:05
Field Validation HELP! Monie JavaScript Forum 5 Nov 11th, 2004 19:46


All times are GMT. The time now is 22:23.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43