| 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 | }}} |
| | 303 | If 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. |
| | 304 | We need a way of avoiding this by desactivating the connection between the submit button and the sendForm method while the fading '''animation''' is active. |
| | 305 | Thanks Dojo there is such things ! in two lines of code its done. |
| | 306 | |
| | 307 | |
| | 308 | {{{ |
| | 309 | function 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 | |
| | 323 | how nice is this ! |
| | 324 | Careful, 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. |
| | 325 | su you need at least revision '''4286'''. |
| | 326 | Update your dojo source |
| | 327 | |
| | 328 | {{{ |
| | 329 | svn co http://svn.dojotoolkit.org/dojo/trunk dojo |
| | 330 | }}} |
| | 331 | |
| | 332 | |
| | 333 | |
| | 334 | |
| | 335 | '''Note''' It might be completely wrong. |