Development

#2224 ([PATCH] JavascriptHelper turns php booleans into javascript strings)

You must first sign up to be able to contribute.

Ticket #2224 (closed defect: fixed)

Opened 1 year ago

Last modified 7 months ago

[PATCH] JavascriptHelper turns php booleans into javascript strings

Reported by: FabianLange Assigned to: FabianLange
Priority: major Milestone: 1.1.0
Component: helpers Version: 1.0.7
Keywords: Cc:
Qualification: Ready for core team

Description

This is a better description for some odd behaviour noted on the mailinglist and described in two tickets #2128 and #1938.

The main issue is that the options passed into the javascript helper methods are treated in various ways. In most cases the correct output is created, especially in the cases where symfony has a different syntax than scriptaculous/prototype: The ajax request attribute synchronous will be true or false because it is checked if the type is set to the string synchronous. But other parameters are taken from the user input. especially problematic are boolean values. javascript expects true or false, but the current helper just prints the value. which is using php's mechanics and will print either 1 or nothing at all. The following patch will convert the type for all potential problematic parameters

Attachments

javascriptHelper.patch (5.9 kB) - added by FabianLange on 09/11/07 20:17:09.

Change History

09/11/07 18:16:33 changed by FabianLange

  • owner changed from fabien to FabianLange.
  • qualification changed from Unreviewed to Design decision.
  • milestone set to 1.0.8.

09/11/07 20:17:09 changed by FabianLange

  • attachment javascriptHelper.patch added.

09/11/07 20:21:03 changed by FabianLange

  • owner changed from FabianLange to noel.
  • qualification changed from Design decision to Ready for core team.

okay, here is my patch. unfortunately the impl was not so straight forward as expected, as the code mixes parameters that might need escaping and those which do not need /should not be escaped (javascript calls/functions, on most of the onXXX handlers)

I checked the patch against all my projects and also the javascript helper examples in the book produce correct results. Unfortunately no unit test for this helper :(

So please check against some javascript heavier projects before applying it to 1.0.8

I verified also tickets #2128 and #1938 against it.

09/11/07 20:31:46 changed by FabianLange

  • summary changed from JavascriptHelper turns php booleans into javascript strings to [PATCH] JavascriptHelper turns php booleans into javascript strings.

10/10/07 10:39:21 changed by gregoire

  • milestone changed from 1.0.8 to 1.1.0.

This means too much changes to the 1.0.x revision. This will be included in the 1.1.x version.

03/10/08 22:44:39 changed by FabianLange

  • owner changed from noel to FabianLange.
  • status changed from new to assigned.

hey i have the honor to now work on my own ticket :-)

03/13/08 10:16:58 changed by FabianLange

  • status changed from assigned to closed.
  • resolution set to fixed.

done in r7855. improved the boolean handling very much. the _options_for_js method will now treat booleans correctly