Zend Framework

wrong string declaration in ajaxLink

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.8.2
  • Fix Version/s: 1.9.0
  • Component/s: ZendX_JQuery
  • Labels:
    None

Description

$callbacks['beforSend'] options using " for the effect string. others like 'complete' use ' for strings. so if it can hapen that zend_view_helper_htmlElement::_htmlAttribs Line 113 uses the false string marker. couse ajaxLink is using both.

for example:

<?php 
echo $this->ajaxLink("foobar",
"/index/dummy",
array(	'beforeSend' 	=> 'hideSlow', 
'complete' 		=> 'show',
'update' 		=> '#pageContent',
'dataType' 		=> 'html',
'inline'		=>	true)); 
?>

produces:

<a href="#" onClick='$(this).hide("slow");$.get('/index/dummy', {}, function(data, textStatus) { $('#pageContent').html(data); $('#pageContent').show(); }, 'html');return false;'>foobar</a>

changing $callbacks['beforSend'] to:

if($callbacks['beforeSend'] != null) {
		    switch(strtolower($callbacks['beforeSend'])) {
		        case 'fadeout':
		            $js[] = sprintf("%s(this).fadeOut();", $jqHandler);
		            break;
		        case 'fadeoutslow':
		            $js[] = sprintf("%s(this).fadeOut('slow');", $jqHandler);
		            break;
		        case 'fadeoutfast':
		            $js[] = sprintf("%s(this).fadeOut('fast');", $jqHandler);
		            break;
		        case 'hide':
		            $js[] = sprintf("%s(this).hide();", $jqHandler);
		            break;
		        case 'hideslow':
		            $js[] = sprintf("%s(this).hide('slow');", $jqHandler);
		            break;
		        case 'hidefast':
		            $js[] = sprintf("%s(this).hide('fast');", $jqHandler);
		            break;
		        case 'slideup':
		            $js[] = sprintf("%s(this).slideUp(1000);", $jqHandler);
		            break;
		        default:
		            $js[] = $callbacks['beforeSend'];
		            break;
		    }
		}

fixes the problem.

Activity

Hide
Benjamin Eberlei added a comment -

Fixed, will be included in the next minor version

Show
Benjamin Eberlei added a comment - Fixed, will be included in the next minor version

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: