I have a scenario on my UI where I need to enable a text box and a button on checking a checkbox and disable both text box and the button when the checkbox is un-checked. Below is the screenshot of what I have:
Below is the code in my jsp:
<tr>
<td>
<stripes:checkbox name="locationselect" onclick="handleDisable(document.forms['dealerTransactionForm'].elements['locationselect'],document.forms['dealerTransactionForm'].elements['locationId'])"/>
<stripes:label for="locationId"/>
</td>
<td>
<stripes:text name="locationId" />
<fmt:message var="tooltip" key="/DealerTransactionReport.action.lookUpLocation"/>
<stripes:submit name="lookUpLocation" class="button" title="${tooltip}" style="width: auto"/>
</td>
</tr>
Below is the handleDisable
function which I wrote:
function handleDisable(checkbox, item) {
if(checkbox.checked == true)
item.disabled = false;
else
item.disabled = true;
}
Currently I'm able to enable only the text box when the checkbox is checked, what change should i make so as to enable both the text box and the button?.