Hi,

I'm stuck with a strange problem.

I have used 4 submit buttons on my form with different submit callbacks.
But clicking on any of the first three buttons are executing the third button's callback. And the fourth button is executing its own correct callback.
Is this some kind of a bug? Please help.

Comments

prashant_nair’s picture

Also, the #value attributes of the first three buttons are the same.
My objective is to have a form with which I can upload 3 different files.
So I'm keeping the #value as 'Upload' for all the three Upload buttons.
Since clicking on any of the buttons produces the same value in $_POST['op'], I have given different submit callbacks for the three submit buttons.
What am I doing wrong?

damien tournoud’s picture

Category: bug » support

You have to give your buttons either a different #value or a different #name. How could Drupal differentiate them if you don't?

prashant_nair’s picture

Category: support » bug
Status: Active » Closed (fixed)

That was really silly on my part.
Didnt know that submit buttons have #name=>'op' by default. Doh!