Autosave model

Hello! I have a large form with a lot of fields. And I want to make autosave. If user fill the form a half for example he can go away and when he back to fill the form he will continue. I don’t know how to make it. Maybe somebody make the same.

You can turn on ajaxValidation on the form.

This will cause each change in the form to be submitted to the server for validating, and meanwhile you can save this form in a special table named, for example, draft.

If your user is not logged in, you can use the phpSessid cookie for differentiate the user: Yii::app()->session->sessionId

I hope it helps

I make it in the same table, but I have draft status. It works but if form validates success, else doesn’t want to save. For example there are some required fields - it will be saved just if required fields filled.

Maybe save just validated fields but how?

If it’s o.k. to save the incomplete attributes to session, you could have a look at my extension here:

http://www.yiiframework.com/extension/defaultpersister

Check out the example. You should be able to adapt it to your case.