sfJqueryReloadedPlugin - 1.2.4

sfJqueryReloadedPlugin offers helpers that integrate the jQuery Javascript framework.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source | Show as Markdown

Jquery Plug-In

The sfJqueryReloadedPlugin offers helpers that integrate the Jquery Javascript framework.


symfony channel @ Freenode IRC.


Please report all bugs to Fourat Zouari (loca|host on IRC)


This plugin is licensed under the MIT license. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.


Jquery is offering an easy API, very well documented and can be a good replacement for the Prototype framework wich's used by default on symfony Javascript's helper.

And since Jquery comes with its powerfull JqueryUI to do effects easily, there's no need to implement scriptaculous.

The integration of sfJqueryPlugin is made simple, developers will have to use the new jQuery helper and prefix the old prototyped methods with jq_.

So the prototype method:

<?php echo link_to_remote(....);?>

will get this new Jquery form:

<?php echo jq_link_to_remote(....);?>


  • Install the plugin

    $ symfony $ symfony plugin:install sfJqueryReloadedPlugin

  • Optional: change jquery_web_dir in setting.yml if you are not using the traditional symbolic link to the webdir of the plugin (or copying the plugin's /web folder to a folder called sfJqueryPlugin in your web dir, which will also work automatically with our defaults)

        jquery_web_dir:      /sfJqueryPlugin
  • Optional: within that folder's /js/ subfolder you might have a different version of jquery other than a minimized 1.3.1 which is what you currently get if you allow the plugin to supply it

        jquery_core:      jquery-1.3.1.min.js
  • Optional: specify different versions of the sortable and autocomplete plugins, which would be looked for in the /js/plugins/ subfolder of your jquery_web_dir

        jquery_sortable: jquery-ui-sortable-1.6rc2.min.js
        jquery_autocomplete: jquery.autocomplete-1.0.2.min.js

If you are under Microsoft Windows, you also have to manually copy the ./web directory of the plugin in the %SF_ROOT_DIR%/web directory of your project and rename it to sfJqueryReloadedPlugin.

Basic syntax

Declaring the helper in templates

  • Inside a template

  • In settings.yml, for all modules

    standard_helpers: jQuery

Using Jquery methods

To use Jquery methods, refer to Chapter 11 Ajax Integration, all helper functions described on the chapter can be used with the jq_ prefix.

jQuery Helpers documentation

Below are complete syntax for ready to use methods in the jQuery Helpers.

  • jq_periodically_call_remote($options = array())
  • jq_link_to_function($name, $function, $html_options = array())
  • jq_link_to_remote($name, $options = array(), $html_options = array())
  • jq_update_element_function($element_id, $options = array())
  • jq_form_remote_tag($options = array(), $options_html = array())
  • jq_submit_to_remote($name, $value, $options = array(), $options_html = array())
  • jq_javascript_tag($content)
  • jq_visual_effect($effect, $element_id = false, $js_options = array())
  • jq_add_plugin($options = array()
  • jq_sortable_element($selector, $options) (tom@punkave.com)

These are the methods reconverted into jQuery functions till the sfJqueryPlugin last version. Future changes will integrate more functions.

Using JSON

http://trac.symfony-project.com/wiki/AjaxAndJSON#jsonwithoutheader and:

                                       'dataType' => 'json',
                                       'success'  => 'leaveGroup(request)')) ?>


  • Add unit tests
  • Use sprintf for string manipulation
  • Implement the rest of the Javascript Helper:

    • sortable_element
    • draggable_element
    • drop_receiving_element
    • input_auto_complete_tag
    • input_in_place_editor_tag


2009-03-10 1.2.3

  • boutell: upgraded to jQuery 1.3.x
  • boutell: ui.sortable for jq_sortable_element
  • boutell: fixed bugs in directory handling options in settings.yml
  • boutell: fixed bug in plugin loader
  • boutell: implemented jq_sortable element
  • boutell: fixed incorrect and undesired quoting of 'with' parameter to jq_remote_function (thanks to JoeZ99)

2008-10-22 | 1.2.1 Stable

  • yannick: Added BaseJavascriptHelper.php function wrapper
  • yannick: Added jq_button_to_remote function
  • yannick: Added jq_submit_image_to_remote function
  • yannick: Added jq_visual_effect function.
  • yannick: Added jquery script in web
  • yannick: Replaced app_sfJQueryPlugin_library_path by sf_jquery_path in setting.yml


  • Tiago.Ribeiro: Added JSON dataType support
  • Tiago.Ribeiro: Removed escaping from 'with' parameter
  • Tiago.Ribeiro: Added request parameter to complete callback
  • francois: Replaced $ by jQuery
  • francois: Made the jQuery lib file configurable

2007-10-17 | 1.0.0 Stable

  • fourat: success, complete, beforeSend and error .ajax options updated just as the jQuery documentation.

2007-10-17 | 0.0.8 Beta

  • fourat: Fixed data parameter handling in jq_remote_function().

2007-10-16 | 0.0.7 Beta

  • fourat: Fixed dataType parameter handling in jq_remote_function().

2007-10-15 | 0.0.6 Beta

  • fourat: Jquery has fixed the documentation and now providing a dataType:text to forbid script execution in returned data (see ticket 1788)

2007-10-11 | 0.0.5 Beta

  • fourat: Fixed method parameter and data serialisation in jq_remote_function.

2007-10-10 | 0.0.4 Beta

  • fourat: Initial release
  • fourat: Implementing basic ajax functions:
    • jq_periodically_call_remote
    • jq_link_to_function
    • jq_link_to_remote
    • jq_update_element_function
    • jq_form_remote_tag
    • jq_submit_to_remote
    • jq_javascript_tag