Ajaxlink Generates An Error Following An Ajax Request In A Cjuidialog

Hi there,

On my main view (myBookings) I’ve got this ajaxLink, it opens a CJuiDialog:




                $target = CHtml::normalizeUrl(array('clientManageBookings/showChangeEndDateDialog'));

                

                echo CHtml::ajaxLink(Yii::t('texts', 'BUTTON_CHANGE_END_DATE'), $target, 

                        array(//ajaxOptions                            

                            'type' => 'POST',                        

                            'update' => '#dialog',

                            'data' => array('bookingId' => $booking->id),

                                ), 

                        array(//htmlOptions

                            'href' => $target,

                            'class' => 'rc-linkbutton-small',

                            'id' => 'endDateLink' . uniqid(),

                                )

                );



Once I click OK in the CJuiDialog I want to refresh the main view (myBookings). So I’ve got this in the CJuiDialog OK button (ajaxSubmitButton).




    'success' => 'function(data) {

                     window.location.href="' . CHtml::normalizeUrl(array('myBookings')) . '"; 

                     

                }



So the 1st code snippet above is re-executed but this time the CHtml::ajaxLink() call does not work. The error message is:




range() [<a href='function.range'>function.range</a>]: step exceeds the specified range 

C:\xampp\htdocs\yii\framework\web\helpers\CJavaScript.php(90)



It looks like something is wrong with the Javascript. Any idea ?

Cheers

Renaud

Have you read this discussion: https://code.google.com/p/yii/issues/detail?id=2317 ?

Thanks Yugene, it works! I did what they say in the conversation I replaced the line 90 with




$n=count($value);

try {

  $range = @range(0, $n-1);

} catch (Exception $e) {

  $range = range(0.0, $n-1);

}

if(($n)>0 && array_keys($value)!==$range)

{



Renaud

Nice to hear topic helped you. Just a notice in a case - please don’t forget it’s better not to change framework code directly as your changes will be overwritten with the next framework update.

Regards,

Yuga