codefog / contao-haste

Haste is a collection of tools and classes to ease working with Contao
http://codefog.pl/extension/haste.html
MIT License
43 stars 24 forks source link

Fetch value of submit fields #78

Closed dmolineus closed 7 years ago

dmolineus commented 8 years ago

$form->fetch('submit'); of a submit field always returns the given value of the submit field no matter if it was submitted or not.

qzminski commented 8 years ago

You mean the situation where you have multiple submit buttons and what to check which one got pressed?

Toflar commented 8 years ago

That's not possible. The very first thing fetch() does, is checking if the form was submitted: https://github.com/codefog/contao-haste/blob/master/library/Haste/Form/Form.php#L979

dmolineus commented 8 years ago

Yes, I'm talking about multiple submit buttons. I can't check which one was clicked. So the form was submitted but the submit button should not be return a value when being not clicked.

qzminski commented 8 years ago

It could be the Contao core issue because the Haste Form does nothing special here apart from returning the value of submit widget like any other. I suggest to check it this way:

if (isset($_POST['submit'])) {
    // ...
}
aschempp commented 8 years ago

So this would be an issue in Contao\FormSubmit widget?

qzminski commented 8 years ago

Yes it is a Contao issue. @dmolineus I think you should report that issue directly to the https://github.com/contao/core