Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
Thread: No empty fields
12-19-2011, 07:05 PM #1
- Join Date
- Nov 2011
- Notre Dame, IN
- Thanked 0 Times in 0 Posts
No empty fields
Then next to the inpput box I display a text in case the user didn't fill in the info like this and by the way the above code is in my validate.php page wich i include in the main registration page
I need some help with a solution for when the user fills in the info and pushes the "register" button the page refreshes and it whipes all the info the user already input but it does display the warnings where the user didn't input any data, so what would be the best way to go to keep the data that the user entered.Thank you.
Last edited by SuperMode55; 12-19-2011 at 07:10 PM.
12-20-2011, 12:23 AM #2
Add to your <form> tag...
The validation() function should include the checks you need for empty or invalid fields.Code:<form action="registration.php" method= "post" onsubmit="return validation()">
It should return false if there are errors and true if all is OK.
Users who have thanked jmrker for this post:
12-20-2011, 08:02 AM #3
- Join Date
- Jun 2002
- London, England
- Thanked 2,547 Times in 2,525 Posts
Form validation of the pattern if (user == true) is barely worthy of the name, and virtually useless, as even a single space, an X or a ? will return false, that is pass the validation. Numeric values, such as zip codes and phone numbers, should be validated as such. Ditto email addresses. This topic has been covered many times before in this forum.
document.write statements must be run before the page finishes loading. Any document.write statement that runs after the page finishes
loading will create a new page and overwrite all of the content of the current page. So document.write is at best really only useful to write
the original content of your page. It cannot be used to update the content of your page after that page has loaded.
All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
Last edited by Philip M; 12-20-2011 at 08:06 AM.
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
12-20-2011, 03:23 PM #4