• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

JavaScript Form Validation only Depends on first element  RSS feed

 
Greenhorn
Posts: 11
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My java-script works and all but the only problem is when the first and last name is correct it automatically ignores all the other form element and submits the form. But if the name elements are incorrect it validates the whole form. How do I get it to continue validating if first and last name is correct?

HTML:



Java:




 
author & internet detective
Sheriff
Posts: 38569
659
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check the JavaScript console in your browser? Maybe you are getting a syntax error?

If not, the next step is to try to make this a smaller example. Right now, it is a lot of code so the problem could be anywhere. Getting rid of some of the fields/validation will let you contain a smaller example that still illustrate the problem.
 
Author and ninkuma
Marshal
Posts: 66806
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Jeanne responded, make sure you are using the browser's debugger. See if there are console errors, and set breakpoints to trace the execution path and check variables.

If you want people to look closely at your code, be sure to format it with correct indentation. As posted, your code is too hard to read.

And lastly, that is JavaScript code, not Java code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!