• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to "enable/disable" radio button in struts2 on click of check box

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have the following code in my jsp.


My java script code


When the page is executed the radio button is not disabled as it contains a list.
I also tried writing a sample html page and created check box and radio button.
I could disable radio button uponclick of checkbox.But I am not able to ahcieve
the same using <s:radio> tag in struts2.
As <s:radio >tag containst list , we cant disable the radio button ?

any inputs on this will be highly appreciated.

thanks,
Jyothsna


 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Examining the HTML emitted by the S2 tags would be a good idea...

I mean, wouldn't that be the *first* thing you'd want to do when some JavaScript doesn't appear to be working the way you'd expect?
 
Jyothsna Panchagnula
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi David,

when I checked the generated html in the view page source ,
The code

is changed to


Since this is a list I guess that there is no way to call the java script funciton
But how do I disable the radio button depending on the checkbox check in struts2

-Jyothsna
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can *call* a JavaScript function, you just need to implement it in such a way that it works.

There are a number of alternatives, including modifying/extending the theme. I'd probably explore an approach that creates the list on the server side so its values can be used both in the S2 tag and by JavaScript.
 
Jyothsna Panchagnula
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi David,

I agree with you. In some of the pages I am following the same approach as you have mentioned.
But here I need to first select the checkbox , once selected then I need to display the radio button , then depending on the selection of radio button I need to display the data populated from the database.

Also I am new to ajax , I am wondering how I have to implement using ajax in struts2.


thanks
Jyothsna
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd probably start by reading the S2 Ajax documentation, but be aware that the Dojo tags have been deprecated. It may be easiest to just use whichever JavaScript library/framework you're most comfortable with.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic