This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes enable/disable drop down Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "enable/disable drop down" Watch "enable/disable drop down" New topic
Author

enable/disable drop down

Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Hi Everyone,

I have two drop boxes in my JSP. When i choose "Yes" in the first drop down, the second drop down should get disabled. When i select "No" then the second drop down should get enabled. I have used struts tag.

How do i implement this?



Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15357
    
    6
disabled does not have a value, it is just disabled and it takes a Boolean not a string when setting it with JavaScript.

Eric
Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Eric Pascarello wrote:disabled does not have a value, it is just disabled and it takes a Boolean not a string when setting it with JavaScript.

Eric


Hi,
Ok ..so you mean to say i cant set disable as true or false? so can you please suggest me how to go about it?I am stuck

Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15357
    
    6
Exactly what I said, disabled does not have a value [attributes].


Eric
Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Eric Pascarello wrote:Exactly what I said, disabled does not have a value [attributes].


Eric


Hey Eric,

Thanks for your help. I tried setting disabled to false. But it is still not working.

I think there is some problem with this line : var DD2 = document.getElementsByProperty("POTX"); alert(DD2);
because i am not getting alert message for DD2.

Since i am using struts tag, i cannot use ID attribute with <html:select>. I have to use property attribute <html:select property="" >.

So what do i do now. javascript:emoticon('');

function DisableTR(value)
{
alert("hi");
alert(value);
var DD2 = document.getElementsByProperty("POTX");
alert(DD2);
if(value == "No")
{
DD2.disabled = false;
}
}

Thanks
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: enable/disable drop down
 
Similar Threads
populate <html:options> with AJAX response
retrieve value of a field
Need help selected text fields visible for particular option from drop down list in JSP(struts)
set text filed values based on drop down selection
JSP Page when submitted, List becomes empty