Upgrading from v3.2

Since version 3.3, PRADO uses jQuery as its default javascript framework. Previously, up to version 3.2, PRADO used Prototype and Scriptaculous as its default javascript framework.

PRADO relies a lot on clientside javascript code to implement its standard controls, to handle clientside validators, and to create a seamless ajax experience using active controls. All this javascript code, originally developed on Prototype, has been rewritten in order to use jQuery instead. The choice was mainly driven by the lack of development and decline of the Prototype community, while jQuery has become the de-facto standard library for javascript.

While the PRADO javascript code is ready to work with jQuery, legacy javascript code in existing applications can require some porting to make it work properly. We summarize in the following the most significant changes in v3.3 to help developers upgrade their v3.2 PRADO applications more easily, if needed.

Basic Prototype to jQuery javascript porting

The number one rule on writing jQuery javascript code is to read the jQuery documentation. Porting code from Prototype to jQuery needs some effort: here's a basic lookup table to port existing code:

Prototype (OLD) jQuery (NEW)
Get element by id $('element_id') // get the base DOM element
// get the the extended element
Get element by css selector $$('.class') $('.class')
Apply a function to multiple elements $$('.class').each(Element.remove) $('.class').remove()
Create or extend a class Class.create(Prado.WebUI.Control, { ... })
Class.extend(Prado.WebUI.Control, { ... })
jQuery.klass(Prado.WebUI.Control, { ... })
Extend an object Object.extend(...) jQuery.extend(...)
Bind an event to a callback event handler Event.observe(element, 'click', callback) $(element).on('click', callback)
Unbind an event from a callback event handler Event.stopObserving(element, 'click', callback) $(element).off('click', callback)
Stop event propagation Event.stop(event) // stop event bubbling chain
// prevent form submit
Detect keypress event if(kc == Event.KEY_RETURN ||
kc == Event.KEY_SPACEBAR ||
kc == Event.KEY_TAB)
// use the numeric codes
if(kc == 13 ||
kc == 32 ||
kc == 9)
Execute a function when the page has finished loading document.observe("dom:loaded", function(event) { ... }) $( document ).ready(function() { ... })
Create an animation effect with a "finish" callback new Effect.Fade(element, {
duration: 400,
afterFinish: function() {
// Animation complete.
$(element).fadeOut( 400, function() {
// Animation complete.
Declare a function to be used as event handler binding its "this" property this.functionName.bindAsEventListener(this) this.functionName.bind(this)
Css class functions (add, remove, test for css class) addClassName()
Get event target inside an event handler Event.element(event) event.target
Get event mouse position Event.pointerX(event)
Fire events Event.fireEvent(this.control, "change") $(element).trigger("change")
Get element size element.getWidth()
Change element contents $('div1').innerHTML='new content' $('#div1').html('new content')
Hook on ajax events Ajax.Responders.register({
"onLoading" : my_function
"onSuccess" : my_function
$( document ).ajaxSend(my_function);
$( document ).ajaxSuccess(my_function);

PRADO specific code changes

PRADO Porting prado to jQuery some method signatures has changed, or have been adapted:

Prototype (OLD) jQuery (NEW)
Implementing the postback handler for a PostBackControl;
the function signature has changed (parameters are inverted):
onPostBack : function(event, options) onPostBack : function(options, event)
Execute a postback Prado.PostBack(options, event); // Create a new object
new Prado.PostBack(options, event);
Test browser software method has been removed Prado.Browser().ie // Test for browser support for specific capabilities instead
// or, better, use Modernizr
Get a PRADO object from an object ID Prado.Registry.get('id') Prado.Registry.['id']

Specific controls changes

Some Prado controls were based on specific extensions of the Prototype + Scriptaculous javascript framework, and they have been deprecated now that jQuery has become the primary js framework in PRADO. PRADO 3.3 introduces jQuery-based counterpart for these controls and encourage everyone to port their code to the new controls, but the old controls are still supposed to work with some minor annoyance:

  • Prototype and Scriptaculous will be loaded along jQuery
  • jQuery will execute in "no conflict" mode, so the $() helper won't call anymore jQuery but Prototype.
Following is the list of deprecated controls:


TAutoComplete is deprecated, use TJuiAutoComplete instead. Main changes in porting existing code using TAutoComplete to TJuiAutoComplete:

  • the Frequency property doesn't exists anymore
  • only the ItemTemplate is supported for the Suggestions repeater (no HeaderTemplate, FooterTemplate, etc..)
  • ItemTemplate doesn't need to render the <li> tag anymore, but only the content itself
  • multiple selections are not supported

TDraggable and TDropContainer

TDraggable and TDropContainer have been deprecated and replaced respectively by TJuiDraggable and TJuiDroppable. The options for the new controls are available at jQueryUI's API documentation.