| | |
disable dropdownlist with javascript
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2005
Posts: 3
Reputation:
Solved Threads: 0
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;
}
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;
}
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.
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.
![]() |
Similar Threads
- Javascript links not working (Web Browsers)
- disable javascript through javascript in firefox (JavaScript / DHTML / AJAX)
- Javascript menu blocked by browser what can I do for alternative (JavaScript / DHTML / AJAX)
- How to enable or disable Internet Explorer tool bar buttons using javascript (JavaScript / DHTML / AJAX)
- Need help in design and javascript code for Dynamic form (JavaScript / DHTML / AJAX)
- Javascript/HTML problem!!! (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: JavaScript/DHTML newbie -- general questions
- Next Thread: Javascript problem in FIREFOX
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child close column createrange() css cursor decimal dependent design disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms google gwt gxt hiddenvalue highlightedword hint html htmlform ie8 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl listbox math media microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php player post problem progressbar regex runtime scroll search security select shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n





