Changes between Version 27 and Version 28 of AjaxDjangoDojoForm


Ignore:
Timestamp:
Jun 7, 2006, 4:09:11 AM (18 years ago)
Author:
coulix
Comment:

p3

Legend:

Unmodified
Added
Removed
Modified
  • AjaxDjangoDojoForm

    v27 v28  
    88Part 1 <br/> <a href="#P1">Ajax basic form submission, Django server answers Ajax call.</a><br/>
    99Part 2 <br/><a href="#P2">Handling the form when JavaScript is deactivated.</a>
     10Part 3 <br/><a href="#P3">Fixing the froze fading when user resend the form without waiting for the first fading to end.</a>
    1011}}}
    1112
     
    296297}}}
    297298
    298 
    299 '''Note'''  I might be doing it completely wrong.
     299{{{
     300#!html
     301<a name="P3"><h1>Fixing the froze fading when user resend the form without waiting for the first fading to end.</h1></a>
     302}}}
     303If you haven't realised yet, if two or more calls are sent to the javascript function sendForm in a short time, the fading effect of the current sendForm Callback method might get stuck / froze / bugged.
     304We need a way of avoiding this by desactivating the connection between the submit button and the sendForm method while the fading '''animation''' is active.
     305Thanks Dojo there is such things ! in two lines of code its done.
     306
     307
     308{{{
     309function sendFormCallback(type, data, evt)
     310    {
     311       [...as before ...]
     312        // and the fancy fading effect
     313       
     314        // first disconnect the listener !
     315        dojo.event.disconnect(sendFormButton, 'onclick', 'sendForm');
     316        // assign our fading effect to an anim variable.
     317        var anim = dojo.lfx.html.highlight("mark_status", [255, 151, 58], 700).play(300);
     318        // When this anim is finish, reconnect
     319        dojo.event.connect(anim, "onEnd", function() {  dojo.event.connect(sendFormButton, 'onclick', 'sendForm'); });
     320    }
     321}}}
     322
     323how nice is this !
     324Careful, while talking about how to fix the problem using onEnd in Dojo IRC chanel, they realised play() method didnt behave properly and updated it to react to onEnd and such.
     325su you need at least revision '''4286'''.
     326Update your dojo source
     327
     328{{{
     329svn co http://svn.dojotoolkit.org/dojo/trunk dojo
     330}}}
     331
     332
     333
     334
     335'''Note'''  It might be completely wrong.
    300336More questions / complaints: coulix@gmail.com
    301337
Back to Top