Reputation: 1311
So I have this radio button and text field in a form. When the page loads, the disable field method gets called and disables the text field. What I am trying to do next is to re enable the text field by activating the radio button. Hence I have an onclick event on the radio button that calls the enablefield method. But its refusing to reactivate the textfield. Is it the syntax you reckon?
<form>
<input type="radio" name="asiinternship" value="Tadween Publishing" onclick="enableField(applyingforother)" />Other <input type="text" name="applyingforother" maxlength="56" style="width:143px;margin-bottom:20px;" />
</form>
<script>
function enableField(myField)
{
myField.disabled = false
return true
}
function disableField(myField)
{
myField.disabled = true
return true
}
disableField(document.forms["contact_form"].applyingforother)
</script>
Upvotes: 0
Views: 1429
Reputation: 219794
You're missing quotes:
onclick="enableField(applyingforother)
should be:
onclick="enableField('applyingforother')
Upvotes: 1