This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Form does not validated correctly

 
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I've been struggling with coding this form for many days. I hope someone can point out to me what went wrong. If a person leaves a blank, then an error message will appear. However, if I didn't enter anything, 2 similar messages appear, which is what I don't want. I only want error message to appear if it is blank or if the data does not conform to the regular expression. Also, I'm not so how to validate the radio button. please please help me.

Here is my code:-

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks to me like a JavaScript issue. Moving to the JavaScript forum...
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no need to do this:


That is just a waste of space and js rendering time.

If you do not want both of the error messages to display, than do not do the second check if the first one fails.

Eric
 
tangara goh
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But it is a requirement. I cannot have blank and I need to have validation rules.

Now, the DOB validation just doesn't work and I am taking it off, leaving the bare necessities.

Please advise and also the reset button. Netbean IDE keeps asking me to define object var.

tks.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

tangara goh wrote:But it is a requirement. I cannot have blank and I need to have validation rules.


I think you'll find that JavaScript does not work the way you believe it does.
 
tangara goh
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a check with my friend. Yes. I just take out one and it will work as I want. Tks.
 
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regarding the radio validator issue, you can refer to the post of https://coderanch.com/t/476954/HTML-JavaScript/Radio-Validator.
 
tangara goh
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
 
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!