Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
25
rated 0 times [  26] [ 1]  / answers: 1 / hits: 95895  / 13 Years ago, thu, march 10, 2011, 12:00:00

What I want is that the text box is only accessible if a certain option is picked from the drop down menu and I have an html form as below:



 <tr>
<td>a.&nbsp;Did any of your staff participate in training or orientation sessions related to any aspect of social performance management, during the reporting year? </td>
<td >
<p>
<select name=mfi_4_a_i>
<option>Yes</option>
<option>No</option>
<option>No, but planning in future</option>
</select>
</p>
<p>if not,and not planning please explain why not </p>
<input type=text name=mfi_4_a_ii id=sdd />
</tr>


Now when a user selects the option No, but planning in future then the text box must be enabled otherwise the textbox must be disabled.



How do I accomplish this?


More From » html

 Answers
16

You should call the javascript function for this.



<select id=mfi_4_a_i name=mfi_4_a_i onChange=changetextbox();>
<option>Yes</option>
<option>No</option>
<option>No, but planning in future</option>
</select>

<input type=text name=mfi_4_a_ii id=sdd />

<script type=text/javascript>
function changetextbox()
{
if (document.getElementById(mfi_4_a_i).value === noy) {
document.getElementById(sdd).disable='true';
} else {
document.getElementById(sdd).disable='false';
}
}
</script>

[#93345] Tuesday, March 8, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
harleyaleenag

Total Points: 678
Total Questions: 121
Total Answers: 105

Location: Papua New Guinea
Member since Thu, Jul 9, 2020
4 Years ago
harleyaleenag questions
Thu, May 5, 22, 00:00, 2 Years ago
Wed, Aug 19, 20, 00:00, 4 Years ago
;