Forum Moderators: open

Message Too Old, No Replies

enabling/disabling

         

crowndlager

8:03 am on Sep 28, 2004 (gmt 0)

10+ Year Member



I have this here, 3 radio buttons and a text box

<table align="center"><tr><td><input type="radio" name="payment" value="direct">Direct Debit <input type="radio" name="payment" value="credit"> Credit Card <input type="radio" name="payment" value="monthly"> Monthly Payments</td><td><input type="text" name="mpayment" size="4"></td></tr></table>

i want to know how i can make the text box only become enabled when the monthly payments radio button is checked.

I was given this but it didnt work, any help would be appreciated.

function Mpay() {
if document.order.payment.value="monthly";
document.order.mpayment.disable=true;
else
document.order.mpayment.disable=false;
}

adni18

12:39 pm on Sep 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to say this will work, but I can't test it, as my computer doesn't like to read files off my hard disk now.

<script language=javascript>
function Mpay() {
if (document.all.payment.checked==1){
document.all.mpayment.disabled=0;
}
else {
document.all.mpayment.disabled=1;
}
}
</script>

crowndlager

9:36 pm on Sep 28, 2004 (gmt 0)

10+ Year Member



thanks adni18, it worked, just had to change it to this

function Mpay() {
if (document.all.payment.checked==1){
document.all.mpayment.disabled=1;
}
else {
document.all.mpayment.disabled=0;
}

cheers