Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery - Run loading graphic function only if all form fields are valid
    primarykey
    data
    text
    <p>I have the following javascript code to validate a simple login form with user name and password - it's the client validation of an asp.net custom validator if that makes a difference.</p> <pre><code> function userValidation(source, arguments) { if (arguments.Value != "" &amp;&amp; arguments.Value != "User name") { if($(source).parents(".loginPanel").find(".errorAsterisk[style*='visible']").length==0) { $(source).parents(".loginPanel").css({ "background-color": "" }); } arguments.IsValid = true; } else { $(source).parents(".loginPanel").css({ "background-color": "#ECC8C8" }); arguments.IsValid = false; } } function passwordValidation(source, arguments) { var passVal = /^((?![&lt;&gt;]).){1,64}$/; if (arguments.Value != "" &amp;&amp; arguments.Value != "Password" &amp;&amp; passVal.test(arguments.Value)) { if($(source).parents(".loginPanel").find(".errorAsterisk[style*='visible']").length==0) { $(source).parents(".loginPanel").css({ "background-color": "" }); } arguments.IsValid = true; } else { $(source).parents(".loginPanel").css({ "background-color": "#ECC8C8" }); arguments.IsValid = false; } } </code></pre> <p>I also want a "Loading" message to appear when the user successfully fills in the form - here's the code I have for that...</p> <pre><code> $(".loginPanel").on("click", "input[id*='Login']", function() { loadingPage2("", "Logging in..."); }); </code></pre> <p>The trouble is, the loading function runs even if the page is not valid.</p> <p>Any ideas where I can include it so it only runs if <em>everything</em> is valid?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload