944,181 Members | Top Members by Rank

Ad:
Jul 31st, 2005
0

disable dropdownlist with javascript

Expand Post »
Hi I am trying to disable a dropdownlist in an asp.net web application whenever the selected index is changed. I have the following javascript in my web app but whenever it gets to the disabled = true line it is falling over. What I want to know is that the correct way to disable a dropdownlist in javascript. The dropdown list is part of a usercontrol which is on the web form so I am not sure how to do this?

DateDrop is the name of the dropdownlist on the usercontrol.
Form1 is the name of the form

function SubmitOnChange(dateOnChange)
{
var temp = dateOnChange.options[dateOnChange.selectedIndex].value;
document.Form1.Hid2.value = temp;
document.Form1.DateDrop.disabled=true;
document.Form1.submit;
}
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
iloveorangesoda is offline Offline
3 posts
since Jul 2005
Aug 1st, 2005
0

Re: disable dropdownlist with javascript

Well the code looks ok... and the attribute disabled exists in the DOM.

However, the next line is a form submit (assuming you are using VB script.. otherwise it being accessed as an attribute instead of a function). But my point is that this function call will submit the form and forward the user to a new page, or back to the current page. So there isn't any point manipulating the current page - it will get refreshed soon anyway.

I'm presuming your using .NET? ihatedotnet.
Reputation Points: 20
Solved Threads: 5
Junior Poster
alpha_foobar is offline Offline
182 posts
since May 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: JavaScript/DHTML newbie -- general questions
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Javascript problem in FIREFOX





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC