PDA

View Full Version : disabling multiple submit buttons


cscs
09-09-2002, 12:54 AM
hello

i have three buttons in my form that i want disabled once the user clicks any of the buttons, all 3 buttons have the same element name (is this a bad idea?), so i thought one

document.form_name.submit.disabled = true;

would suffice for the 3 buttons, however, they're not disabling for some reason. can anyone tell me what i'm doing wrong?

my three buttons:

<input type="submit" name='mail_submit' value="send" class='input'>
<input type="submit" name='mail_submit' value="send & delete" class='input'>
<input type="submit" name='mail_submit' value="delete" class='input'>

virtualshock
09-09-2002, 02:35 AM
Hmm..I'll try to take a stab at this one:

Because you have 3 buttons with the same name, i think that there's not just a single submit object, but an array of submit objects. So instead of saying

submit.disabled = true;

I think you have to say

submit[0].disabled = true;
submit[1].disabled = true;
submit[2].disabled = true;

cscs
09-09-2002, 03:02 AM
worked like a charm! pure wizardry, thanks very much.