File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes enabling/disabling checkboxes on selection change in Struts' JSP form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "enabling/disabling checkboxes on selection change in Struts Watch "enabling/disabling checkboxes on selection change in Struts New topic
Author

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

Tanveer Rameez
Ranch Hand

Joined: Dec 11, 2000
Posts: 158
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 ]

Author of JPhotoBrush Pro (www.jphotobrushpro.com)
Tausif Khanooni
Ranch Hand

Joined: Nov 14, 2002
Posts: 107
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


"Walking on water and building IT Architecture from <br />specification are easy if and only if both are frozen"
Tanveer Rameez
Ranch Hand

Joined: Dec 11, 2000
Posts: 158
it did help.
thanks
 
 
subject: enabling/disabling checkboxes on selection change in Struts' JSP form
 
Similar Threads
Changing options(contents) of a select element in Struts' jsp form
Cannot retrieve mapping for action
Retriving values from html:checkbox in a jsp
html:checkbox disable property
new to Struts