javascript form - error when hitting enter

Joshua Frazier
Joshua Frazier used Ask the Experts™
on
I am working on a landing page that has a contact form made with javascript. It connects to my Email Service Provider. If someone enters in the three fields correctly, the info passes to my ESP just as it should. However, if someone hits the "enter" key too early, they get taken to another page with an error message. I would like an alert to display instead, that says what fields the person needs to fill out before they will be able to submit.

The page is available here: http://smcu.com/promos/auto-lg-aw/

Thank you,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Expert of the Year 2008
Top Expert 2008
Commented:
You have no field with id="LastName".  So, somewhere around line 242, try changing:
function checkRequired(errors) {
	var reqfieldsString = "FirstName,LastName,PhoneNumber";
...
}

Open in new window

to:
function checkRequired(errors) {
	var reqfieldsString = "FirstName,PhoneNumber";
...}

Open in new window

Joshua FrazierMarketing Manager / Creative Services

Author

Commented:
Yes! That did the trick! Thank you so much, I can't believe I didn't see that.
Joshua FrazierMarketing Manager / Creative Services

Author

Commented:
Thank you so much for your help!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial