double posting/sending #2431

NestorAcevedo opened this Issue Sep 24, 2012 · 2 comments


None yet
2 participants


i've noticed that sending a form from mootools code, this makes a double sending of data from the same form. i have the following code:

window.addEvent('load', function() {
                new JCaption('img.caption');
            window.addEvent('domready', function() {
                //Vamos a recibir el elemento formulario
                elementoFormulario = $("comente");
                //Vamos a a�adir un evento al formulario para cuando se env�e
                elementoFormulario.addEvent('submit', function(e) {
                   //primero voy a parar el evento para que no se env�e como lo har�a normalmente
                   //Aqu� podr�amos hacer acciones como mostrar la t�pica imagen de cargando de Ajax
                   //Luego definimos qu� hacer cuando se env�a el formulario
                   //Aqu� "this" se refiere al formulario sobre el que defino el evento
                   this.set('send', {
                      //onComplete sirve para definir qu� hacer cuando se recibe la respuesta
                      onComplete: function(respuesta) {
                                if(respuesta != "false") {
                                    //escribo la respuesta en la capa "comentario"
                                    $("post-comment").set('html', '<div class="comments">' + respuesta + "</div>");
                                    tinyMCE.execCommand("mceCleanUp", false);
                                    document.getElementById("correo").value = "";
                                    document.getElementById("titulo").value = "";
                                } else {
                                    alert("el codigo captcha es incorrecto");
                   //Env�o el formulario

as can be seen XD in this code first i catch the form element for after make the submit addevent. into it, i stop the normal sending, define what to do when i get the response with oncomplete. in oncomplete, i catch if response is "false" or not, when is "false" i show an alert error, else, i put the response in a div. and the end i send the form. the logic is: stop the normal sending, set the send actions, and after, send the form.

the problem is that this is sending twice the same form content and i'm having in troubles for catch why. before 1.4.x (hehe i don't remember when begun to happen that) the sending were normal -one click, one sending-


arian commented Sep 24, 2012

Try to move the the onComplete 'option' outside the submit event. Each time you submit, it gets added again.


arian closed this Sep 24, 2012

just i've changed the code according to suggested but the problem still
persists. you can check this in

filling the data, and after accesing to

with user: test and pwd: 123, in Comente component menu, you will find
the message repeated.

El 24/09/2012 06:16 p.m., Arian Stolwijk escribió:

Try to move the the onComplete 'option' outside the submit event. Each
time you submit, it gets added again.


Reply to this email directly or view it on GitHub
#2431 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment