Hi friends
i am working on php validations. in my application 1- 10 text fields are there i.e
name, age , date etc...
I have done with all the validations but when i press the submit button and if there is a error in date field then its showing that please enter valid date. But the application is clearing all the fields and again i have to enter all the values like name, age, date etc....
can anyone help me in writing this javascript so that....when i enter wrong data at that time itself i would be able to know that there is a error in field and i can correct it out...
thank you
help me to write javscript : instant validation
Moderator: General Moderators
-
om.bitsian
- Forum Commoner
- Posts: 36
- Joined: Wed Sep 09, 2009 4:13 am
Re: help me to write javscript : instant validation
You can't trust the user's content - they might have turned off javascript and submitted incorrect information - so you have to validate on the server. The only advantages of validating on the client as well is speed and saving a tiny bit of bandwidth.om.bitsian wrote:can anyone help me in writing this javascript
-
om.bitsian
- Forum Commoner
- Posts: 36
- Joined: Wed Sep 09, 2009 4:13 am
Re: help me to write javscript : instant validation
i think onion is right......anyway thanks shinephp for javascript.......now in php for every input
i am writing this code
<input type="text" name="username" value="<?php if(isset($_POST['SUBMIT'])) eco $_post['username']; ?>">
this code is working ...and the application is not clearing alll the fields.......
please tell me how can i show error message infront of that field and highlight with red color so that user can know that here is a error.....
i.e if i write in php page
Name : 6317432 Error : Please enter character value
Age : 24
date : 09/09/2009
thanks
i am writing this code
<input type="text" name="username" value="<?php if(isset($_POST['SUBMIT'])) eco $_post['username']; ?>">
this code is working ...and the application is not clearing alll the fields.......
please tell me how can i show error message infront of that field and highlight with red color so that user can know that here is a error.....
i.e if i write in php page
Name : 6317432 Error : Please enter character value
Age : 24
date : 09/09/2009
thanks
-
om.bitsian
- Forum Commoner
- Posts: 36
- Joined: Wed Sep 09, 2009 4:13 am
Re: help me to write javscript : instant validation
thanks.......its working now