| Author |
Javascript Validation for Struts Radio Button
|
Mark Butcher
Ranch Hand
Joined: Jun 28, 2012
Posts: 41
|
|
Hi there,
I am working on struts 1.3 application.
I am fetching list from database and displaying them dynamically as radio buttons.
I am using html:radio tags. Now I want to validate these radio buttons and
alert that atleast one radio button is mandatory.
Thanks,
Mark.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Have you done any JavaScript validation before? What trouble are you having?
Eric
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56185
|
|
|
First, ditch any illusion that the fact that the elements are generated by Struts tags has anything at all to do with it. Those tags execute on the server and end up sending plain old HTML to the browser. It's that HTML that matters. A View Source, or opening the JavaScript debugger, will reveal the HTML sent to the browser. That's what your JavaScript code will be working with.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56185
|
|
If you're using jQuery, the check is as easy as:
Assuming that the name of the radio group is group -- change accordingly.
|
 |
 |
|
|
subject: Javascript Validation for Struts Radio Button
|
|
|