Hi List

I try this
1.- The submit form call mitaller.alta
2.- Popup alert(1)
3.- The data is corrected inserted in database
4.- I expected this.exito run, but not
5.- Popup alert(2)

Why "exito" not run OnSuccess?
If change it to: onSuccess: alert("popup") yes work fine.

var Taller = Class.create({
  alta: function (event){
    event.stop();
alert(1);
    new $('main_form').request({
                 parameters: $('main_form').serialize(),
                 onSuccess: this.exito,
                 onFailure: this.error
             });
alert(2);
  },

  exito: function (transport){
alert(3);
    var XML = transport.responseXML.documentElement;
    var response = XML.getElementsByTagName('respuesta')
[0].childNodes[0].nodeValue;
    if (response == 'bien'){
       var accion = XML.getElementsByTagName('accion')
[0].childNodes[0].nodeValue;
       if (accion=='alta'){
           exito_alta(XML);
       }else if(accion=='modificar'){
           exito_modificar(XML);
       }else if(accion=='eliminar'){
           exito_eliminar(XML);
       }
    }else{
       var error_type = XML.getElementsByTagName('error_type')
[0].childNodes[0].nodeValue;
       var error_description =
XML.getElementsByTagName('error_description')
[0].childNodes[0].nodeValue;
      // var content_error = ;
       str = '<strong>Placa:</strong>' + $('bplac').value +
'<br><strong>Error tipo:</strong>' + error_type +
            '<br><strong>Descripcion:</strong>' + error_description;
       $('estado').update(str);
    }
  },
})

var mitaller = new Taller();
document.observe('dom:loaded', function(){
   $('main_form').observe('submit', mitaller.alta);
});

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to