Wiki source code of ERPrototaculous
Version 245.1 by Ravi Mendis on 2009/07/16 09:46
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
100.1 | 1 | == Introduction == |
2 | |||
![]() |
209.1 | 3 | ERPrototaculous was developed to provide the ajax functionality in ERDivaLook. |
4 | |||
5 | === What is ERPrototaculous? === | ||
6 | |||
![]() |
233.1 | 7 | Features include: |
![]() |
209.1 | 8 | |
![]() |
233.1 | 9 | * 'Organic' support for Prototype and Scriptaculous in WebObjects. |
![]() |
245.1 | 10 | * No custom Prototype extensions |
11 | * A set of widgets in the Prototype + Scriptaculous family. | ||
![]() |
241.1 | 12 | * Use of [[Unobtrusive Javascript>>http://en.wikipedia.org/wiki/Unobtrusive_JavaScript]]. |
13 | * Pseudo-stateless ajax responses | ||
![]() |
233.1 | 14 | |
15 | ==== Unobtrusive Javascript in ERPrototaculous ==== | ||
16 | |||
17 | Unobtrusive javascript is used in contrast to on-demand style of ajax programming. | ||
18 | By including Javascript as well as CSS globally in the page wrapper, CSS and/or Javascript doesn't have to load inside ajax requests. | ||
19 | |||
20 | The result is **faster** and more **reliable** ajax in WebObjects applications. | ||
21 | |||
22 | ==== Prototype WebObjects Elements ==== | ||
23 | |||
24 | ##Ajax.Updater## and ##Ajax.Request## have been implemented as WebObjects dynamic elements. | ||
25 | |||
26 | ===== Ajax.Updater ===== | ||
27 | |||
28 | Support for Prototype's [[Ajax.Updater>>http://www.prototypejs.org/api/ajax/updater]] is in the form of three components: | ||
29 | |||
30 | * AjaxUpdaterLink | ||
31 | * AjaxUpdaterButton | ||
32 | * AjaxUpdaterForm (with ##onsubmit## for ajax form submission) | ||
33 | |||
![]() |
239.1 | 34 | These components will update a **container** on the page. |
35 | |||
![]() |
233.1 | 36 | ===== Ajax.Request ===== |
37 | |||
38 | Prototype's [[Ajax.Request>>http://www.prototypejs.org/api/ajax/request]] is in the form of: | ||
39 | |||
40 | * AjaxRequestLink | ||
41 | * AjaxRequestButton | ||
42 | |||
![]() |
239.1 | 43 | These are used for strictly **background** ajax communication. |
44 | |||
![]() |
229.1 | 45 | ==== Prototype + Scriptaculous Widgets ==== |
![]() |
211.1 | 46 | |
![]() |
209.1 | 47 | * Accordion |
48 | * LightWindow | ||
49 | * ModalBox | ||
50 | * CalendarDateSelect | ||
51 | * FileUpload | ||
![]() |
233.1 | 52 | |
53 | == Forms in ERPrototaculous == | ||
54 | |||
55 | Differences from using forms in WebObjects. i.e ##WOForm##: | ||
56 | |||
57 | 1. All form controls must be named. This includes text fields, selects and buttons. | ||
58 | (WebObjects dynamically assigned names are not compatible with ERPrototaculous). | ||
59 | 1. All forms in an ERPrototaculous app are instances of ##AjaxUpdaterForm##. | ||
60 | 1. Form submits can be the form of a: | ||
61 | |||
62 | * | ||
63 | ** Static ##<button>## | ||
64 | ** WOSubmitButton (if the result is to update whole page/app. | ||
65 | ** AjaxUpdaterButton (to update a **container**). Or | ||
66 | ** AjaxRequestButton (for a background ajax request) | ||
![]() |
241.1 | 67 | |
![]() |
245.1 | 68 | == Page Caching Ajax in ERPrototaculous == |
![]() |
241.1 | 69 | |
70 | One notable difference in the ERPrototaculous and Ajax.framework is in the ajax responses. | ||
71 | ERPrototaculous updates and actions break with "The WebObjects Way" by being pseudo-stateless. | ||
72 | |||
73 | Instead of returning a new context, an ajax update or action is in fact the same. | ||
74 | |||
![]() |
245.1 | 75 | The reason returning a new context is not necessary is because a client never travels back or forwards through an ajax application unlike in a typical WebObjects app. Here the current state (or context) of the update or action is all that is necessary. |