Hi I have a weird problem using the form plugin on a login page on my
site, the form html is:

<form id="form_login" name="form_login" method="post"
enctype="multipart/form-data" action="dologin.php">

     Form elements.....

</form>

I'm using dologin.php to check the login and password on my DB if the
login and pass is ok it returns 'ENTER', if its correct but the user
is disabled it returns 'DISABLED' else returns 'ERROR', and I handle
that with this form plugin script:

$('#form_login').ajaxForm({
                beforeSubmit: function (){
                        // Check if fields arent empty...
        },
                success: function(r){
                       alert(r); // Checks the response..
                        if (r=='ENTER'){                            //User 
accepted
                                window.location.href = 'index_app.php';
                        }else if (r=='DISABLED'){              //User disabled
                                errorMsg('User disabled');
                        }else{                                         //Bad 
login or pass
                                errorMsg('Bad login or pass');
                        }

        },
                error: function(respuesta){
                        // Error msg
                }
});

I'm using the alert to check the response im getting from the
dologin.php file and the problems I'm getting are:
1. If the login OR password isn't right, I ALWAYS get the current page
html as response.
2. I the login AND password is right, the FIRST time i get the current
page html as response.
3. After that the script works as intended (alert shows ENTER, ERROR
or DISABLED depending on the case).

It seems as in the first two cases the form is not going into the
"action" (I placed echo 'TEST'; in the dologin file to check if it
showed on the alert but on the first 2 cases all I get is the html).

Can anyone help me with this? Thanks in advance!

Reply via email to