Yii Show Confirmation Window After Validate And Before Save

Hi, guys!

I have to implement a specific behavior on page admin.php (to insert or update records) in Yii. Currently, when the user clicks the Save button, the application submits the page and makes the server side validations, reloading the page, showing the errors (if exists), or redirected to a search page, if the inclusion is performed successfully. What I need is that after validation, but before saving, the application do a search for a specific set of fields in the database and show a confirmation screen asking the user if he really wants to save that record or not, saving the record based on user response. I tried to implement this: http://www.yiiframework.com/forum/index.php/topic/37075-form-validation-with-ajaxsubmitbutton/ with the query to the database done through jquery, but it did not work for me because the custom validations were not executed and the application had a "NetworkError: 500". Besides, I do not want validations being made when the user exit or change each field, only on submit. My code was generated by Gii tool and I am using CActiveForm and $form->errorSummary($model) to show errors.

Any clues?


I would add a parameter to the action, for example ‘confirm’. For the first submit, pass false and then display another confirmation page. Then submit again passing true. To submit same form from the confirmation page you could try using stateful form.

On the second thought, the param may be just a form field, since it’s posted on two pages.

Hi please see it

i hope it’s some help.

Thanks, I will try something, if works, I will put the results here!