Reputation: 13590
well I do have partial form with its ajaxsubmitbutton and it's working alright, but If I tried to partially render another form with another ajaxsubmitbutton, or even add another submitbutton under that form it doesn't work. here's my ajaxbutton code:
echo CHtml::ajaxSubmitButton(
'Delete', array(
'submit' => $this->createUrl('logInOfficeEmp/delete', array('id' => $model->id)),
'type' => 'POST',
), array('type' => 'post',), array('id' => 'deletesubmit',));
the reason might because the action was supposed to be delete :
jQuery('body').undelegate('#deletesubmit','click').delegate('#deletesubmit','click',function(){jQuery.ajax({'type':'POST','url':'/mySystem/index.php?r=logInOfficeEmp/update&id=159', 'cache':false,'data':jQuery(this).parents("form").serialize()});return false;});
});
Upvotes: 0
Views: 2542
Reputation: 149
It might be connected to button id (deletesubmit). I think you should use something unique, as example try to replace code:
array('id' => 'deletesubmit',)
with:
array('id' => 'deletesubmit_'.$model->id,)
Upvotes: 1