• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javascript Validation for Struts Radio Button

 
Mark Butcher
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you done any JavaScript validation before? What trouble are you having?

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're using jQuery, the check is as easy as:
Assuming that the name of the radio group is group -- change accordingly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic