View Full Version : Checkbox with Input Field
demarcao
06-28-2002, 12:51 PM
Hello,
I need to figure out how to do the following:
When someone selects a particular checkbox an input field right next to it become editable. Otherwise the input field is readonly.
Any pointers would be great,!
- Alex
bcarl314
06-28-2002, 01:03 PM
html code might golike this...
<input type="checkbox" name="myBox">
<input type="text" onFocus="checkTheBox()">
and the js something like this...
function checkTheBox() {
if(!document.forms[0].myBox.checked) {
alert("Unable to edit");
document.forms[0].myBox.focus();
}
This could be modified to enable/disable the text field as well.
demarcao
06-28-2002, 01:13 PM
hmm, I get an object expected error. Does the javascript go in the head section? that's the way I have it.
- alex
adios
06-28-2002, 07:47 PM
<input type="checkbox" name="edit_enable1"
onclick="t1.readOnly=!this.checked;t1.focus()">
<input type="text" name="t1" readonly="readonly">
demarcao
07-01-2002, 01:00 PM
HOw would you make the input line invisible?
- Alex
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.