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.
|
|
|
|
|
![]() |
||
Non-text field Validation
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
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 |
|
|
|
#2
|
||||
|
||||
|
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.
|
|
#3
|
|||
|
|||
|
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.
|
|
#4
|
||||
|
||||
|
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.
|
|
#5
|
||||
|
||||
|
Re: Non-text field Validation
|
|
#6
|
|||
|
|||
|
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 |
|
#7
|
|||
|
|||
|
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.
|
![]() |
| Tags |
| form validation |
| Thread Tools | |
|
|
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 |