Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Tanveer Rameez
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • 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 ]
 
Tausif Khanooni
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
it did help.
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic