I have a form that has Two radio button and a text box that sends information to the database. Text box is initially disabled. When I click Yes it enables the text box and user can input into the text box. When I click no it disables the text box and uploads a pre determined value via hidden input.
Problem: When I click on yes it the text box is still disabled. Not sure what I am doing wrong
HTML code:
<input type="radio" name="TermLease" value="No" onclick="TermLeaseMonths.disabled=true"/>No
<input type="radio" name="TermLease" value="Yes" onclick="TermLeaseMonths.disabled=false"/>Yes |
How many months:<input type="hidden" name="TermLeaseMonths" value="0" />
<input type="text" name="TermLeaseMonths" id="TermLeaseMonths" size="1" disabled="disabled"/>
<input type="radio" name="TermLease" value="No" onclick="document.getElementById('TermLeaseMonths').disabled=true"/>No <input type="radio" name="TermLease" value="Yes" onclick="document.getElementById('TermLeaseMonths').disabled=false"/>Yes
(disclaimer: I'm against inline JS) – j08691