Yii, how to custom submit button in cactiveform

I am using CJuidialog widget to wrap a view file, and I don't want the default 'save' button because I would like to use a javascript to make an ajax call to the server for data validation, then save it. I tried below:

         echo CHtml::submitButton('Create');
         echo '<button onClick="javascript: _updatedata('.$model->id.');">Save</button>';

when the save button is clicked. it still will go to the actionUpdate to save the form data, however I have created an action to just save my data.

function updatedata(id)
    var url = '<?php echo Yii::app()->request->baseUrl ?>' + '/index.php?r=user/profileupdate&id='+id;


        url: url,
        type: 'POST',
        dataType: "html",
        success: function(data, textStatus, XMLHttpRequest) {
                     if (data != null && data == "success")


If you got your question correct then what you are saying that instead of default button you need something that you can perform Ajax Things rite? if yes then you need to have Ajax Submit Button. Yii gives you liberty to use ajax more easily then you are trying to do. Please see CJuiDialog and AjaxSubmitButton

Need Your Help

Infragistics XamDataGrid Group By on load in WPF

c# wpf infragistics xamdatagrid

How can I set a Group By on Load for a given property for the XamDataGrid from Infragistics, and making the view of this uncollapsed with the ability to collapse the group disabled?

What is the exact problem with multiple inheritance?

oop multiple-inheritance language-theory

I can see people asking all the time whether multiple inheritance should be included into the next version of C# or Java. C++ folks, who are fortunate enough to have this ability, say that this is ...