PDA

View Full Version : Disable Second Field


petertran123
11-11-2002, 07:29 PM
Hello all,

I wanted to have a disable function for the following fields. Let say i have 3 fields on the form, and when user's entered information into first field and i wanted the other 2 fields disable. Can someone help me with that. Thanks much

x_goose_x
11-11-2002, 07:56 PM
this good?


<form>
<input type="textbox" name="button1" onChange="if (this.value!='') { this.form.button2.disabled=true; this.form.button3.disabled=true; }else{ this.form.button2.disabled=false; this.form.button3.disabled=false; };">
<input type="textbox" name="button2">
<input type="textbox" name="button3">
</form>

Mr J
11-11-2002, 08:14 PM
Did you mean buttons or text fields.

For text fields, try this




<form name="f1">
<input type="text" name="t1" value="" onkeypress="test()"><br>
<input type="text" name="t2" value="Hello"><br>
<input type="text" name="t3" value="World"><br>
</form>

<script>
function test(){
if(document.f1.t1.value.length>=1){
document.f1.t2.contentEditable=false
document.f1.t3.contentEditable=false
}
else{
document.f1.t2.contentEditable=true
document.f1.t3.contentEditable=true
}
setTimeout("test()",100)
}
</script>

petertran123
11-11-2002, 08:18 PM
i'm talking about text fields


when someone is entering first text field and i wanted the other two text fields is automatically disable...

thanks for your help