Here is a form page that requires a valid email and name for submission. There are three input fields: name, age and email. However, the name and email fields are required while the age field is optional.
Here is a form page that requires a valid email and name for submission. There are three input fields: name, age and email. However, the name and email fields are required while the age field is optional.
this page submits info into my database where i can read it, and then choose to respond.
i added the javascript to this pages that requires an entry in the name, email and comment fields as well as a valid email address... comments in the .js file show where i got my code and help from.
it validates
This is web prog 5d. It's the email and name validate one. It's about how QU students should have a choice between owning a Mac or a PC instead of just blindly choosing what the school tells you to get.
A no-frills javascript validator that checks for blank spaces and makes sure the correct type of character is used. Still thinking about totally foolproof email validation. Not too good for security, though, since javascript can be turned off by the user.
After some trials and tribulations I was able to get the form validation script to work with my recipe comments page. This page verifys that the user has entered their full name - no names less than 5 characters or greater than 25 characters, and that the email address is properly formatted. Not only does it let the user know that there are errors, but it also highlights the fields in yellow where the errors exist.
This is a link to a working comments page (linked to a database table) which requires a valid name and email address before submission using Javascript. An error message appears & fades at the bottom of the form if something is omitted. I also made the same thing happen using PHP, so there are also messages at the top of the page from that code. I got the Javascript from http://www.leigeber.com/2008/04/dynamic-inline-javascript-form-validation/, and included this citation in my js page. Upon submission, a thank you message appears at the top of the form.
Second try at the vaildation form. Matt thanked me, but I have to thank him for bringing the lack of name validation to my attention. After trying a seperate code for this page, the address validator has been tweaked abd works much better now.
I used my style sheet from a previous quiz to create a from that required a first name and a valid email address. The validation code came from w3schools, while the required field stuffs came from http://javascript.internet.com/. Because the code came from different sources they required a little tweaking, and I felt the need to add my own unique voice to the pop-up warnings.
I also suggest checking out this site for some help with javascript and validation! unlike some other sites, the color properties of the different code help to make things visually clearer, and thus, easier to understand when trying to work out how the code is set up.
got this form to validate fields.
the script i found also highlights the fields you foul up, and also gives a different message depending on if you put in an invalid email address, or just left it empty. cool!
I finally got this going once I found the right site with a validator form. I tried multiple places, and after getting stuck and having to tweak a bunch of things, I finally settled on this basic form.
http://www.netmechanic.com/news/vol6/javascript_no4.htm