ajaxButton support in CFormButtonElement

Hi

I wanted to use CForm to create an Ajax-based form. However, it seems that CFormButtonElement doesnt support ajaxButton’s.

I added the ajaxButton support to CFormButtonElement. However, my guess is that it wasnt already there due to a reason.

Anyone knows why CFormButtonElement doesnt support CHtml::ajaxButton()? would my patch be welcome? If yes i’ll post it here.

I wanna it too,and I wanna the best practice of this post http://www.yiiframework.com/forum/index.php?/topic/15971-how-to-return-a-form-widget-in-a-components-or-else/

From the api doc http://www.yiiframework.com/doc/api/1.1/CFormButtonElement




The type property can also be a class name or a path alias to the class. 

In this case, the button is generated using a widget of the specified class.

 Note, the widget must have a property called "name". 



how to set this,I wanna an ajaxsubmit button :rolleyes:

Hi,

i’ve got the solution.

  1. assign key ‘attributes’ to your button with an array as value

  2. assign key ‘ajax’ in array attributes and configure linke ajaxButton, ajaxSubmitButton.


            'buttons' => array(

                'login' => array(

                    'type' => 'submit',

                    'label' => 'Speichern',

                    'attributes' => array(

                        'class' => 'submit',

                        'ajax' => array(

                            'type' => 'POST', //request type

                            'url' => Yii::app()->createUrl($this->getId() . '/AjaxTest'), //url to call.

                            'update' => '#content', //selector to update

                        )

                    ),

                ),

            )

Best Regards

M. Bunge