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