Hi there,
Really hoping someone can help me out as I’ve messed about with this for hours and really haven’t got anywhere… I’m following the documentation to the letter and trying every posisble variation with no luck and now I’m going a little crazy… scoured the net and all possible forums but nothing explains quite what I’m doing wrong.
I have a simple form which is successfully submitting with CHtml::ajaxsubmitbutton:
echo CHtml::ajaxSubmitButton(
($model->isNewRecord ? 'Create' : 'Save'),
$actionUrl,
array(
'update' => "#$myContainer",
'dataType' => 'html',
'complete' => $updateStatusScript
),
array()
);
This all gets sent to the Controller fine and I’m PHPFirebugging the resulting $_POST array out the other end.
So, after looking at the documentation I figured I could send some additional params using the htmlOptions array which is currently empty, so I did this:
echo CHtml::ajaxSubmitButton(
($model->isNewRecord ? 'Create' : 'Save'),
$actionUrl,
array(
'update' => "#$myContainer",
'dataType' => 'html',
'complete' => $updateStatusScript
),
array(
'submit' => $actionUrl,
'params' => array(
'hello' => 'hi there',
'oh' => 'yes'
)
)
);
And all I get it jQuery.yii is undefined. The whole error being as follows:
jQuery('#yt0').live('click',function(){jQuery.yii.submitForm(this,'/index.php/workRequest/update/56',{'hello':'hi there','oh':'yes'});return false;jQuery.ajax({'dataType':'html','complete':function(request, status) {
var statusContainer = $("#ajaxNotification1");
statusContainer.html('Operation successful.');
},'type':'POST','url':'/index.php/workRequest/update/56','cache':false,'data':jQuery(this).parents("form").serialize(),'success':function(html){jQuery("#workRequestFormContainer").html(html)}});return false;});
jQuery('#yt1').live('click',function(){if(confirm('Are you sure you want to delete this item?')) {jQuery.yii.submitForm(this,'/index.php/workRequest/delete/56',{});return false;} else return false;});
So I don’t get it. It’s probably something really obvious - I’m new to Yii but loving it.
Any help would be greatly appreciated.
Thanks!