Changes between Version 23 and Version 24 of AjaxDjangoDojoForm
- Timestamp:
- Jun 6, 2006, 11:54:22 AM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AjaxDjangoDojoForm
v23 v24 6 6 {{{ 7 7 #!html 8 Part 1 <br/> <a href="#P1">Ajax basic form submi tion, Django server answer return toAjax call.</a><br/>9 Part 2 <br/><a href="#P2">Handling the form when JavaScript is de sactivated.</a>8 Part 1 <br/> <a href="#P1">Ajax basic form submission, Django server answers Ajax call.</a><br/> 9 Part 2 <br/><a href="#P2">Handling the form when JavaScript is deactivated.</a> 10 10 }}} 11 11 … … 13 13 {{{ 14 14 #!html 15 <a name="P1"><h1>Ajax basic form submi tion, Django server answer return toAjax call.</h1></a>16 }}} 17 '''Ajax form submi tion using Dojo for the client sidejavaScript toolkit, and simpleJson for the client/server communication.'''18 19 This will take you through all the steps required to get started and to develop a handy form submi ttion without reload.15 <a name="P1"><h1>Ajax basic form submission, Django server answers Ajax call.</h1></a> 16 }}} 17 '''Ajax form submission using Dojo for the client side javaScript toolkit, and simpleJson for the client/server communication.''' 18 19 This will take you through all the steps required to get started and to develop a handy form submission without reload. 20 20 21 21 … … 29 29 == What do we want to achieve == 30 30 I will use the model of my current website, a recipe one. 31 When a regist red user see the details of a recipe, the user can mark it or update their markby selecting a small drop down list.32 But when the user clicks ok the whole page reloads. We will use some Ajax to make it transparent and for thefancy effect33 we can add fading status message like "Your markhas been updated".34 The select box proposes a mark from 1 to 5, it is actually a form which is sent to the server via POST, which in django linkto a method35 in the view.py : ''def details(request)'' which do the innerwork for the details page generation.31 When a registered user sees the details of a recipe, the user can rate (mark) it or update their rating (mark) by selecting a small drop down list. 32 But when the user clicks ok the whole page reloads. We will use some Ajax to make it transparent and for fancy effect 33 we can add a fading status message like "Your rating has been updated". 34 The select box proposes a rating from 1 to 5, it is actually a form which is sent to the server via POST, which in django links to a method 35 in the view.py : ''def details(request)'' which does the innerwork for the details page generation. 36 36 37 37 … … 173 173 174 174 To have a demo use guest as login, guest as password here [http://ozserver.no-ip.com:345] or if not working here [http://www.cefinban.net]. 175 Go to index and pick a recipe, update the mark.175 Go to index and pick a recipe, update the rating. 176 176 177 177 You can also have a look at the screenshot here : [http://ozserver.no-ip.com/~greg/images/ajaxdjango.png] … … 199 199 {{{ 200 200 #!html 201 <a name="P2"><h1>Handling the form when JavaScript is de sactivated.</h1></a>202 }}} 203 If a user has de sactivated his browser javascript support, or is using a text mode browser, we need a way of making the previous marking button submit the markto the server which should this time return an html template instead of data to the Ajax call.201 <a name="P2"><h1>Handling the form when JavaScript is deactivated.</h1></a> 202 }}} 203 If a user has deactivated his browser's javascript support, or is using a text mode browser, we need a way of making the previous rating button submit the rating to the server which should this time return an html template instead of data to the Ajax call. 204 204 205 205 == Updating the form HTML (details.html template)== 206 206 This time we put a submit type input inside the form instead of the button type in part 1. 207 type="submit" as indicates its name, submits the form to the server, we will need a way of stopping this behavior using javaScript.207 type="submit" as indicates its name, submits the form to the server, we will need a way of stopping this behavior using javaScript. 208 208 209 209 {{{ … … 258 258 }}} 259 259 260 The dojo binding need to append a variable to the original document url, to make ajax_or_not not None.260 The dojo binding needs to append a variable to the original document url, to make ajax_or_not not None. 261 261 262 262 {{{