I try to create a login window with a ajax call.
I need to click 2 time on OK to validate :

Click 1 :
        function validAuthentification : retour = true or false,  but  
validAuth = undefined
Click 2 :
        function validAuthentification :  retour = true or false, validAuth  
= retour

I don't understand why

Thanks for your help.

Sorry for my english

Code :

function validAuthentification()
{
        var retour;
        var nom;
        var passe;

        
        nom=$('nomAuth');
        passe=$('passAuth');    
        new Ajax.Request('./validauth.php',
        {
                method:'post',
                postBody:$H({nom:nom.value,passe:passe.value}).toQueryString(),
                onComplete: function(reponse)
                {
                        if(reponse.status==200)
                        {               
                                 if(reponse.responseText=="-")
                                        retour= false;
                                 else           
                                        retour= true;
                        }
                        else
                        {
                                 retour= false;
                        }
                                                
                }
        });

        return retour;
}



function loadAuth()
{
        ]var validAuth;
        
        Dialog.confirm($('login').innerHTML,
                                {id:"monLogin",
                                className:"alphacube", width:400,
                  okLabel: "login",
                  cancelLabel: "annuler",
                  onOk:function(win)
                  {
                        validAuth=validAuthentification();
                        return validAuth;
                  }
                });
}

function init()
{
        Event.observe('butAuth', 'click', loadAuth);
}


Event.observe(window, 'load', init);

_______________________________________________
Javawin mailing list
[email protected]
http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com

Reply via email to