M
M
MUTOgen4eg2015-08-19 12:06:31
Yii
MUTOgen4eg, 2015-08-19 12:06:31

How to detect which button was clicked in beforeValidate event in Yii2?

There was such a situation. There is a form and 2 submit buttons, which should lead to a different effect.
In the first case, everything is standard and the beforeValidate event should work in full (there is, in fact, the process of generating a certain alert).
In the second case, this alert must be disabled.
The first thing that comes to mind is to determine which button was pressed in the form's beforeValidate event. But I did not find access to such information inside the handler. This is real?
If not, are there other ways to introduce such conditional logic on form submission?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
matperez, 2015-08-19
@MUTOgen4eg

Maybe you can go from the opposite: hang a handler on a button click, and in it already initiate form validation?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question