Own Success Callback On Yii Cactiveform

Hi,

I have an webpage containing many small forms created by CActiveFrom widget. Sending form data happens trough ajax in the background, which works fine.

But now, I need to display the return string from the ajax call, after the form was processed successful.

Is there a way to define an own callback-function, which is fired after successfully send the CActiveForm?

Thank you,

rall0r.

To answer my own question… maybe someone has the same issue. The solution is quit simple.

This CActiveForm sends data using Ajax, because the submit button is an CHtml::ajaxSubmitButton.

So the secret is not to set an callback function at the form-widget configuration. You have to use the ‘success’ option from the ajaxSubmitButton:


    echo CHtml::ajaxSubmitButton('Save', 'http://post.date.url), 

                                      array('success'=>'function(data){console.info(data);}'),  

                                      array('title'=>'Click to save','class'=>'submitBtn' ));

Try this Code In Your Own jave script function

[color="#2E8B57"]url ="//Url Path;

$.ajax({url:url,success:function(result){

$("#mainscreen").html(result);

$("#new_req").show();

}});[/color]