• 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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
Posts: 38906
684
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.
 
Marshal
Posts: 67162
169
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!