ajaxSubmitButton reset form after submit

Hi everyone;

First, wannna tell that I did search hard for this solution here, but nothing found. I would like to reset a form after submiting with CHtml::ajaxSubmitButton. I try use onclick in htmlOptions array, but this event occurs before submit; so nothing is sent. Somebody can help me?

Do you have some code for us? Its hard to identify errors or problems without having a piece of related code.

You can specify ajaxOptions for the ajaxSubmitButton. (http://www.yiiframework.com/doc/api/CHtml#ajaxSubmitButton-detail)

I think you can do some like





$ajaxOptions = array();

$ajaxOptions['success'] = "$('#formId').reset()"



Where ‘formId’ is the id of your form tag.

For $ajaxOptions[‘succes’] you need to send a full qualified callback function.

Try this:




$ajaxOptions = array('succes'=>'function(e,u) { $("#formId").reset(); }');