Behat/Mink — Issue #100: Not possible to submit form with multiple (submit) buttons
Author: luku
Created: 2011-10-12 12:44:38+00:00
State: open

Hi,
I'm having trouble with Mink and GoutteDriver in this special case. I have a form with one action and several buttons. Every button has its name and based on the submitted data array I find out if user pressed button A, or button B, C....

However Goutte always submits form referencing to first submit button in DOM tree. If there is none (only ordinary type="button"), no matter what id|title|name|value of button I pass it always just submitts the form without any of the form button data. If there are many submit buttons, no matter what id|title|name|value of button I pass it always just submitts the form with the first button data.

So I tried to fake it with hidden field, but there is no way to change the value for hidden fields based on the pressed button in my own steps or in FeatureContext. Or am I wrong?

My other shot was to "clone" click() method from GoutteDriver and add the name of clicked button into parameters array on the fly. But there is the catch that $forms array storing already filled forms with data is private, so there is no way to update the form values before the actual request. Either I loose what was checked/selected/filled in, or I don't know what action shall I execute.

Is there any way around this? Or is it something that I can call issue?

Thanks, luku