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

Component Info Database Android

android sql database database-design

I am getting the following errors when I start my andriod app. It is a giant database:

HSQL Unit Test — How to Create Multiple In-Memory Schemas?

maven junit hsqldb

I would like to use hsql within my DAO unit tests for a web application. The web app is written against mysql and uses three different schemas within the same mysql database. Some schemas has FK

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.