Changes between Version 11 and Version 12 of AJAX/Dojo/RefactoredFormSubmit
- Timestamp:
- Feb 11, 2007, 10:58:04 AM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AJAX/Dojo/RefactoredFormSubmit
v11 v12 4 4 Here's a simple recipe that worked for me. It is quite inspired by the [wiki:AjaxDojoFormSub] example―and from [http://www.b-list.org/weblog/2006/07/31/django-tips-simple-ajax-example-part-1 this tutorial]―except that this recipe is expected to use python-cjson for receiving JSON data. 5 5 6 My initial objective was to display validation errors without doing a page-refresh, by using JSON 7 for carrying errors (or whatever else you could possibly imagine) back to the client browser. 6 My initial objective was to display validation errors without doing a page-refresh, by using JSON for carrying errors (or whatever else you could possibly imagine) back to the client browser. 8 7 9 8 === The server view === … … 58 57 }}} 59 58 60 The ''djConfig.isDebug''parameter is important for debugging, so you should59 The {{{djConfig.isDebug}}} parameter is important for debugging, so you should 61 60 consider setting it to "true" when inspecting you're application with Firebug 62 61 or something else. … … 109 108 }}} 110 109 111 Notice the removal of the formNode parameter for postContent, and the 112 use of ''dojo.io.encodeForm'' to parse/encode the form data in 113 a proper format. 110 Notice the removal of the {{formNode}} parameter for {{postContent}}, and the 111 use of {{dojo.io.encodeForm}} to parse/encode the form data into 112 a proper format. That is all required for having the {{{XMLHTTPRequest}}} 113 object handled by the Dojo toolkit. 114 115 To connect the input submit button with the JS callback, use the following 116 line: 117 {{{ 118 #!text/html 119 <input type="button" onclick="validate()" id="fooBtn"></input> 120 }}} 121 122 Have fun! That recipe should work in Firefox 2 and Opera 9.10. 114 123 115 124 === Limitations/Bugs === … … 124 133 === References === 125 134 126 etc. 135 * blah 127 136 128 137