Yii Framework Forum: Ajaxlink Generates An Error Following An Ajax Request In A Cjuidialog - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Ajaxlink Generates An Error Following An Ajax Request In A Cjuidialog Rate Topic: -----

#1 User is offline   Renaud 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 49
  • Joined: 04-October 11

Posted 17 March 2013 - 04:18 PM

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
0

#2 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 513
  • Joined: 08-August 09

Posted 18 March 2013 - 05:49 AM

Have you read this discussion: https://code.google..../detail?id=2317 ?
0

#3 User is offline   Renaud 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 49
  • Joined: 04-October 11

Posted 18 March 2013 - 11:26 AM

View Postyugene, on 18 March 2013 - 05:49 AM, said:

Have you read this discussion: https://code.google..../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
0

#4 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 513
  • Joined: 08-August 09

Posted 18 March 2013 - 02:31 PM

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
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users