S
S
sz92014-06-17 10:31:28
Yii
sz9, 2014-06-17 10:31:28

How can you make rules in Yii?

Good afternoon.
Available on the field page. "Registration" and "Authorization". This is one form.
How to make it so that when you click "authorize" the rules are executed only for authorization fields.
Well, in fact, so that when you click "registration" the rules for the registration fields are fulfilled.
Let me remind you that this is one form. And there is only one model.
If to hang up on jquery on buttons event that to add hidden fields.
And then in the rules do something like:

if($_POST['from']['aut'] == 1) { // выполняем правила для авторизации }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dima Barsukov, 2014-06-17
@mrsombre

Scripts , and the script itself is passed as a hidden field.

A
Alexander Makarov, 2014-06-17
@SamDark

Divide into two forms. You shouldn't create problems for yourself.
Then do this:

<input type="submit" name="a">
<input type="submit" name="b">

In the controller:
Well, then we set the script depending on this, as shown by darkgool.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question