Page 1 of 1
toggling text buttons on and off
Posted: Thu Jan 12, 2006 11:40 am
by Luke
I am looking for a way to disable about 5 or 6 text fields by checking a checkbox. I know that you can do this by this method...
document.orderform.textfield.disabled = true
but I just can't get it to work properly.
What I would like even better is if I could make the fields just appear when the textbox is clicked... like with a invisible div or something... suggestions?
Posted: Thu Jan 12, 2006 11:47 am
by pickle
If you want them to appear and disappear, you could just toggle the display property between 'block' and 'none'.
Posted: Thu Jan 12, 2006 11:48 am
by John Cartwright
If I'm not mistaken, isn't it
disable not disabled
Posted: Thu Jan 12, 2006 1:14 pm
by Roja
Jcart wrote:If I'm not mistaken, isn't it disable not disabled?
Nope. Disabled. As in, the current state is
disabled, not perform the action, disable this control.
http://www.w3.org/TR/REC-html40/interac ... ml#h-17.12
Posted: Thu Jan 12, 2006 1:41 pm
by Luke
nvm... I did this instead...
Code: Select all
function toggleShipping(){
if(document.order.shipping.checked == 1){
document.getElementById("shippinglist").style.visibility = "visible";
document.getElementById("shippinglist").style.height = "auto";
}
else{
document.getElementById("shippinglist").style.visibility = "hidden";
document.getElementById("shippinglist").style.height = "0px";
}
}
Posted: Thu Jan 12, 2006 1:50 pm
by pickle
Just a note that disabled elements aren't posted. Invisible elements are.