aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Form does not validated correctly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Form does not validated correctly" Watch "Form does not validated correctly" New topic
Author

Form does not validated correctly

tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
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:-

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Looks to me like a JavaScript issue. Moving to the JavaScript forum...


GenRocket - Experts at Building Test Data
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Dec 27, 2009
Posts: 125
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.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Dec 27, 2009
Posts: 125
I have a check with my friend. Yes. I just take out one and it will work as I want. Tks.
Zhixiong Pan
Ranch Hand

Joined: Jan 25, 2006
Posts: 239
Regarding the radio validator issue, you can refer to the post of http://www.coderanch.com/t/476954/HTML-JavaScript/Radio-Validator.


SCJP 1.4 SCJD
tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Form does not validated correctly