| | |
dropdownlist disable other dropdownlist
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
A very simple and crude snippet:
I would leave to you the job of putting those bunch of statements in a separate function and changing the way the function is called as per your requirement.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<select name="first" id="first" onchange="if(this.value == 'no') document.getElementById('sec').disabled=true; else document.getElementById('sec').disabled=false;"> <option value="yes">Yes</option> <option value="no">No</option> </select> <br /><br /> <select name="sec" id="sec"> <option value="yes">Yes</option> <option value="no">No</option> </select>
Last edited by ~s.o.s~; Aug 21st, 2007 at 12:58 pm.
I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
•
•
Join Date: Aug 2007
Posts: 2
Reputation:
Solved Threads: 0
Thank for your help mate.
Problem is that solution is perfect for html form, not asp.net - therefore I cannot use it within <br> and <td> tags in asp form. I also cannot use method onchange, web developer says that it is no supported by dropdownlist. Any ideas how to trick it? Thanks a lot for your time.
Finch
Edit: Here's the code I want to change:
<asp:View ID="View4" runat="server">
<table cellpadding="4" cellspacing="4">
<tr>
<td colspan="2"><b>Section 3 - Health and Safety Policy and Arrangements</b></td>
</tr>
<tr>
<td>3.1 Does your company have a written Health and Safety Policy?</td>
<td><asp
ropDownList ID="HealthPolicy" runat="server" >
<asp:ListItem></asp:ListItem>
<asp:ListItem>No</asp:ListItem>
<asp:ListItem>Yes</asp:ListItem>
</asp
ropDownList>
</td>
</tr>
<tr><td>If yes, please provide us with copy of your health and safety policy. Please go to section 3.3. If No, please answer question 3.2</td></tr>
<tr>
<td>3.2 Does your company employ 5 or persons?</td>
<td><asp
ropDownList ID="Employ5" runat="server" Enabled="False" >
<asp:ListItem></asp:ListItem>
<asp:ListItem>No</asp:ListItem>
<asp:ListItem>Yes</asp:ListItem>
</asp
ropDownList>
</td>
</tr>
Problem is that solution is perfect for html form, not asp.net - therefore I cannot use it within <br> and <td> tags in asp form. I also cannot use method onchange, web developer says that it is no supported by dropdownlist. Any ideas how to trick it? Thanks a lot for your time.
Finch
Edit: Here's the code I want to change:
<asp:View ID="View4" runat="server">
<table cellpadding="4" cellspacing="4">
<tr>
<td colspan="2"><b>Section 3 - Health and Safety Policy and Arrangements</b></td>
</tr>
<tr>
<td>3.1 Does your company have a written Health and Safety Policy?</td>
<td><asp
ropDownList ID="HealthPolicy" runat="server" ><asp:ListItem></asp:ListItem>
<asp:ListItem>No</asp:ListItem>
<asp:ListItem>Yes</asp:ListItem>
</asp
ropDownList></td>
</tr>
<tr><td>If yes, please provide us with copy of your health and safety policy. Please go to section 3.3. If No, please answer question 3.2</td></tr>
<tr>
<td>3.2 Does your company employ 5 or persons?</td>
<td><asp
ropDownList ID="Employ5" runat="server" Enabled="False" ><asp:ListItem></asp:ListItem>
<asp:ListItem>No</asp:ListItem>
<asp:ListItem>Yes</asp:ListItem>
</asp
ropDownList></td>
</tr>
Last edited by finch; Aug 21st, 2007 at 6:46 pm.
![]() |
Similar Threads
- Loading All Database Name (ASP.NET)
- GetSelectedIndex Datagrid? Dropdownlist (ASP.NET)
- POpulate DataGrid (VB.NET)
- DropDownList (ASP.NET)
- Drop Downlist Not Loading (VB.NET)
- disable dropdownlist with javascript (JavaScript / DHTML / AJAX)
- DataGrid: Edit mode, the index of a dropdownlist does not start at the right Value (ASP.NET)
- How do I save an index to a particular index of a dropdownlist in a datagrid. (C#)
- Help With Datagrid RE: Creating and Saving DropDownList ReportsToID (C#)
Other Threads in the JavaScript / DHTML / AJAX Forum
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxexample ajaxjspservlets api autoplay blackjack browser bug captchaformproblem checkbox child class close codes cookies createrange() cursor date debugger dependent developer disablefirebug dom dropdown editor element embed engine events explorer ext file flash form forms game getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images internet java javascript javascripthelp2020 jquery jsf jsfile jump libcurl maps math matrixcaptcha media mp3 mysql object onerror onmouseoutdivproblem onreadystatechange parent passing paypal pdf php player position post programming progressbar rated runtime safari scriptlets scroll search security session shopping size software star stars stretch synchronous tweet unicode variables web webkit webservice window wysiwyg \n






