Page 1 of 1

Disable a textfield when a checkbox is checked

Posted: Fri Jun 18, 2004 6:33 am
by tores
Hi

Is it possible to have a html text field disabled if or if not a checkbox is checked, without having to submit a post and reload the whole page? If it's possible I would like to know how.

tores

Posted: Fri Jun 18, 2004 7:44 am
by Buddha443556
You could use javascript.

Code: Select all

<input type="checkbox"  name="is_new" value="1" onclick="
bVal=!this.checked;
topic_name.disabled=bVal;
if(!bVal)topic_name.focus()
" checked>

<input type="text" name="topic_name">