aspose file tools*
The moose likes JSP and the fly likes Validating a JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Validating a JSP" Watch "Validating a JSP" New topic
Author

Validating a JSP

Hari Dhanakoti
Ranch Hand

Joined: Jan 07, 2008
Posts: 74
Hi,

I am using a sample jsp page to work on the javascript validation. My form components resembles as such...



If i access form components as such then it gives alert as undefined.


If i access form components as such then it gives alert with the first component value.



What should i do for validating the jsp...


Regards,
Hari
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

hi,

1) there is a loop right so every time same name onlt asigned to the input tag ..so if you want to take 2 nd value use
---------------------------------------------------

alert(document.validForm.first1[1].value);...etc
------------------------------------------------------

2) if you want to use getElementById then you have to set new name for every iteration ...because if you want to use getElementById then field name should uniqu other wise it will give first matching value ........

hint:

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

what happend ? post is lengthy!(big wide)
Hari Dhanakoti
Ranch Hand

Joined: Jan 07, 2008
Posts: 74
Hi seetharaman ,

Thanks for your reply.
The above mentioned case works well with checkboxes.
Incase of using the radio buttons i would like to have a unique name to represent.

So how do i handle it in case of radio buttons.
Any suggestions?
Hari Dhanakoti
Ranch Hand

Joined: Jan 07, 2008
Posts: 74
Hi,

I got the things working...

Thanks for your reply.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

you are welcome
 
Consider Paul's rocket mass heater.
 
subject: Validating a JSP