• 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

enabling/disabling checkboxes on selection change in Struts' JSP form

 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I don't know which is the proper forum for this problem.
I have a jsp form used in the struts architecture.
The condensed jsp code is given below:

So initially 'Mortgage Protection' is selected in the drop down and the
'Serious Illness Only' checkbox is disabled.
Now What I want: When I change the selection in the drop down box to 'Term Assurance', the 'Serious Illness Only' checkbox should be enabled.
Similarly when I change the selection back to 'Mortgage Protection' , the checkbox should be disabled.
I think we need to use javascript.like:

where there is a javscript function called productSelected(). is this the right way? then what do I do in this method?
I think in the javascript method I can write something like this

but there is no name of the form. The form name is not known when i write the jsp using the struts tag library. Only when the jsp is rendered in the browser, and I do a 'View source' i can see a name of the form.
I am working on the back-end stuffs mainly so cannot spend time to learn the jsp and struts tag libs now. So I don't have much idea about the jsp tag libs, so please give the complete code/script that does this.
thanks in advance
Tanveer
[ August 18, 2004: Message edited by: Tanveer Rameez ]
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

U can use this script to enable / disable the check boxes

function doStuff(){
document.forms[0].C2.disabled=true;
document.forms[0].C1.disabled=false;
}
function doRevStuff(){
document.forms[0].C1.disabled=true;
document.forms[0].C2.disabled=false;
}


hope this helps
 
Tanveer Rameez
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it did help.
thanks
 
But how did the elephant get like that? What did you do? I think all we can do now is read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic