ZF-6629: CLONE -ZenX JQuery callback function names do not pass down correctly

Issue Type: Bug Created: 2009-05-12T18:01:21.000+0000 Last Updated: 2009-05-15T04:22:29.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Chris Anderson (chris.ncic) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_Json

  • ZendX_JQuery

Related issues: - ZF-4588



I noticed that the callback function names do not pass to the actual JQuery call correctly.


I have in my View a code like this:

<pre class="highlight">
    $params = array(
                    "resize" => "doMyThingAtResize",
                    "title" => "My Zend Dialog",
    echo $this->dialogContainer("dialog1", "Some text", $params, array('class' => 'flora'));

It will produce a JQuery call like this:

<pre class="highlight">
$("#dialog1").dialog({"resize":"doMyThingAtResize","title":"My Zend Dialog"});

This does work in other ways, but the callback for resize event does not get called as the value is text and not a function name.

What we would need it to produce would be like this:

<pre class="highlight">
$("#dialog1").dialog({"resize": doMyThingAtResize,"title":"My Zend Dialog"});

Same thing doMyThingAtResize without the quotes.

Problem goes AFAIK goes to Zend_Json and PHP json_encode as they will wrap the value with quotes, but I don't think this can be solved there. One solution might be to add a separate function or parameter to add those callback function names. This means some manual code work to merge these into the variables passed to the JQuery call, but I don't see many other options.


Posted by Chris Anderson (chris.ncic) on 2009-05-12T18:08:31.000+0000

seems like the same issue persists into 1.8, and the latest release in svn (r15478 for zendx, and r15563 for zend). i'm still getting the double quotes around the function name. thanks for your help and time.

Posted by Benjamin Eberlei (beberlei) on 2009-05-15T04:22:29.000+0000

The correct way to express this would be:

<pre class="highlight">
    $params = array(
                    "resize" => new Zend_Json_Expr("doMyThingAtResize"),
                    "title" => "My Zend Dialog",
    echo $this->dialogContainer("dialog1", "Some text", $params, array('class' => 'flora'));

This stops Zend_Json from escaping the field.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.