Olaf wrote:
> 
> 
> function submitLoginForm() {
>   //validation is working so I know that the load form function worked
>   // when this do, then is submitted
>    if ( ($("#username").val()=="" ) || ($("#passwd").val()=="" )) {
>      alert ("Please complete the username and password fields.");     
>      return false;
>    } else {
> 
>    //THIS IS THE PART CAUSING TROUBLE
>    // what is to do, #username and #passwd are valid
>    // what make we now with this??? ;)
>       
> }
> 
> 

Thanks, Olaf.  Since last posting I reworked the javascript (pretty much as
you said):

function submitLoginForm() {
        if  ($("#username").val()=="" ) {
                alert ("Please complete the username fields."); 
                return false;
        } else if  ($("#passwd").val()=="" ) {
                alert ("Please complete the password field.");  
                return false;
        } else {
                $('#frmLogin')[0].submit();
        }
}

function loadLoginForm() {

        $("#js").val("1");
        $("#submit").keydown( function() { 
                submitLoginForm(); 
                return false;
        }).click(function(){
                submitLoginForm();
                return false; 
        });
}

I tested the functions without the image replacement and discovered that the
whole thing works well when the javascript is called from a submit button,
rather than the image used in the replacement.   So the submit function
can't be called from an image like this:

<img src="images/sign-in.png" alt="Sign in" border="0" width="67"
height="20" tabindex="4" class="img_button" id="submit" />

with the submitLoginForm() function attached, but works fine with this:

<input type="image" name="submit" id="submit"
value="Sign in" src="images/sign-in.gif" tabindex="4" />

with the same function attached.

I'm rather bummed by this because it leaves me with a very ugly button with
daggy jaggedy edges.


-- 
View this message in context: 
http://www.nabble.com/Form-not-submitting-tf3025179.html#a8421157
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to