emilsedgh
(Emilsedgh)
June 22, 2010, 11:05am
1
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.
e6nian
(Tech)
February 5, 2011, 9:16am
2
e6nian
(Tech)
February 5, 2011, 9:31am
3
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
mbunge
(Marco Bunge)
November 26, 2011, 12:54am
4
Hi,
i’ve got the solution.
assign key ‘attributes’ to your button with an array as value
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