jQuery Validate Not Working












0















I have an issue with my code it seems the .validate is not working but all the documents are connected and working sweet:



HTML:



<!DOCTYPE html>
<html>
<title>Site Name Quote Form</title>
<link rel="stylesheet" href="http://domain.co.nz/_assets/css/style.css"/>
<body>
<div id="wrapperQuote">
<h1>Site Name Quote</h1>

<p class="quoteError"><?php echo validation_errors(); ?></p>

<p class="step">Step 1: Company Details</p>

<form id="quote" action="home/hosting" method="post">
<fieldset>
<legend>Company Details:</legend>
<label for="companyName">Company Name: </label><input type="input" name="companyName" id="companyName"/>
<label for="companySlogan">Company Slogan: </label><input type="input" name="companySlogan" id="companySlogan"/>
<label for="companyContact">Company Contact: </label><input type="input" name="companyContact" id="companyContact"/>
<label for="companyEmail">Company E-Mail: </label><input type="email" name="companyEmail" id="companyEmail"/>
<label for="companyWebsite">Company Website: </label><input type="url" name="companyWebsite" id="companyWebsite" placeholder="http://"/>
<label for="companyPhone">Company Phone: </label><input type="phone" name="companyPhone" id="companyPhone"/>
<label for="companyFax">Company Fax: </label><input type="phone" name="companyFax" id="companyFax"/>
<label for="companyAddress">Company Address: </label><textarea name="companyAddress" id="companyAddress"></textarea>
<input type="submit" class="nextButton" value="Next" />
</fieldset>
</form>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="http://domain.co.nz/_assets/js/jquery-1.7.2.min.js"></script>')</script>
<script src="http://domain.co.nz/_assets/js/jquery.validate.min.js"></script>
<script src="http://domain.co.nz/_assets/js/quote.js"></script>
</body>
</html>


quote.js:



jQuery(document).ready(function() { 
//Home Validation
$("#quote").validate({
rules:{
companyName:{
required: true,
url: true
}
}
});
etc etc









share|improve this question

























  • are you gettin any error message?

    – pollirrata
    Apr 12 '12 at 22:23






  • 1





    have you tried setting the class to "required" on an input element and see if that works? That's another way to declare rules. And as above, are you getting any console errors?

    – Daniel Hallqvist
    Apr 12 '12 at 22:29






  • 1





    What does "does not work" mean?

    – Sparky
    Apr 12 '12 at 22:37











  • Your code is working exactly as expected... jsfiddle.net/ex44R/1

    – Sparky
    Apr 12 '12 at 23:14
















0















I have an issue with my code it seems the .validate is not working but all the documents are connected and working sweet:



HTML:



<!DOCTYPE html>
<html>
<title>Site Name Quote Form</title>
<link rel="stylesheet" href="http://domain.co.nz/_assets/css/style.css"/>
<body>
<div id="wrapperQuote">
<h1>Site Name Quote</h1>

<p class="quoteError"><?php echo validation_errors(); ?></p>

<p class="step">Step 1: Company Details</p>

<form id="quote" action="home/hosting" method="post">
<fieldset>
<legend>Company Details:</legend>
<label for="companyName">Company Name: </label><input type="input" name="companyName" id="companyName"/>
<label for="companySlogan">Company Slogan: </label><input type="input" name="companySlogan" id="companySlogan"/>
<label for="companyContact">Company Contact: </label><input type="input" name="companyContact" id="companyContact"/>
<label for="companyEmail">Company E-Mail: </label><input type="email" name="companyEmail" id="companyEmail"/>
<label for="companyWebsite">Company Website: </label><input type="url" name="companyWebsite" id="companyWebsite" placeholder="http://"/>
<label for="companyPhone">Company Phone: </label><input type="phone" name="companyPhone" id="companyPhone"/>
<label for="companyFax">Company Fax: </label><input type="phone" name="companyFax" id="companyFax"/>
<label for="companyAddress">Company Address: </label><textarea name="companyAddress" id="companyAddress"></textarea>
<input type="submit" class="nextButton" value="Next" />
</fieldset>
</form>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="http://domain.co.nz/_assets/js/jquery-1.7.2.min.js"></script>')</script>
<script src="http://domain.co.nz/_assets/js/jquery.validate.min.js"></script>
<script src="http://domain.co.nz/_assets/js/quote.js"></script>
</body>
</html>


quote.js:



jQuery(document).ready(function() { 
//Home Validation
$("#quote").validate({
rules:{
companyName:{
required: true,
url: true
}
}
});
etc etc









share|improve this question

























  • are you gettin any error message?

    – pollirrata
    Apr 12 '12 at 22:23






  • 1





    have you tried setting the class to "required" on an input element and see if that works? That's another way to declare rules. And as above, are you getting any console errors?

    – Daniel Hallqvist
    Apr 12 '12 at 22:29






  • 1





    What does "does not work" mean?

    – Sparky
    Apr 12 '12 at 22:37











  • Your code is working exactly as expected... jsfiddle.net/ex44R/1

    – Sparky
    Apr 12 '12 at 23:14














0












0








0


0






I have an issue with my code it seems the .validate is not working but all the documents are connected and working sweet:



HTML:



<!DOCTYPE html>
<html>
<title>Site Name Quote Form</title>
<link rel="stylesheet" href="http://domain.co.nz/_assets/css/style.css"/>
<body>
<div id="wrapperQuote">
<h1>Site Name Quote</h1>

<p class="quoteError"><?php echo validation_errors(); ?></p>

<p class="step">Step 1: Company Details</p>

<form id="quote" action="home/hosting" method="post">
<fieldset>
<legend>Company Details:</legend>
<label for="companyName">Company Name: </label><input type="input" name="companyName" id="companyName"/>
<label for="companySlogan">Company Slogan: </label><input type="input" name="companySlogan" id="companySlogan"/>
<label for="companyContact">Company Contact: </label><input type="input" name="companyContact" id="companyContact"/>
<label for="companyEmail">Company E-Mail: </label><input type="email" name="companyEmail" id="companyEmail"/>
<label for="companyWebsite">Company Website: </label><input type="url" name="companyWebsite" id="companyWebsite" placeholder="http://"/>
<label for="companyPhone">Company Phone: </label><input type="phone" name="companyPhone" id="companyPhone"/>
<label for="companyFax">Company Fax: </label><input type="phone" name="companyFax" id="companyFax"/>
<label for="companyAddress">Company Address: </label><textarea name="companyAddress" id="companyAddress"></textarea>
<input type="submit" class="nextButton" value="Next" />
</fieldset>
</form>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="http://domain.co.nz/_assets/js/jquery-1.7.2.min.js"></script>')</script>
<script src="http://domain.co.nz/_assets/js/jquery.validate.min.js"></script>
<script src="http://domain.co.nz/_assets/js/quote.js"></script>
</body>
</html>


quote.js:



jQuery(document).ready(function() { 
//Home Validation
$("#quote").validate({
rules:{
companyName:{
required: true,
url: true
}
}
});
etc etc









share|improve this question
















I have an issue with my code it seems the .validate is not working but all the documents are connected and working sweet:



HTML:



<!DOCTYPE html>
<html>
<title>Site Name Quote Form</title>
<link rel="stylesheet" href="http://domain.co.nz/_assets/css/style.css"/>
<body>
<div id="wrapperQuote">
<h1>Site Name Quote</h1>

<p class="quoteError"><?php echo validation_errors(); ?></p>

<p class="step">Step 1: Company Details</p>

<form id="quote" action="home/hosting" method="post">
<fieldset>
<legend>Company Details:</legend>
<label for="companyName">Company Name: </label><input type="input" name="companyName" id="companyName"/>
<label for="companySlogan">Company Slogan: </label><input type="input" name="companySlogan" id="companySlogan"/>
<label for="companyContact">Company Contact: </label><input type="input" name="companyContact" id="companyContact"/>
<label for="companyEmail">Company E-Mail: </label><input type="email" name="companyEmail" id="companyEmail"/>
<label for="companyWebsite">Company Website: </label><input type="url" name="companyWebsite" id="companyWebsite" placeholder="http://"/>
<label for="companyPhone">Company Phone: </label><input type="phone" name="companyPhone" id="companyPhone"/>
<label for="companyFax">Company Fax: </label><input type="phone" name="companyFax" id="companyFax"/>
<label for="companyAddress">Company Address: </label><textarea name="companyAddress" id="companyAddress"></textarea>
<input type="submit" class="nextButton" value="Next" />
</fieldset>
</form>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="http://domain.co.nz/_assets/js/jquery-1.7.2.min.js"></script>')</script>
<script src="http://domain.co.nz/_assets/js/jquery.validate.min.js"></script>
<script src="http://domain.co.nz/_assets/js/quote.js"></script>
</body>
</html>


quote.js:



jQuery(document).ready(function() { 
//Home Validation
$("#quote").validate({
rules:{
companyName:{
required: true,
url: true
}
}
});
etc etc






jquery jquery-validate






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 15:48









Sparky

82.7k20151241




82.7k20151241










asked Apr 12 '12 at 22:20









Jess McKenzieJess McKenzie

4,1992184143




4,1992184143













  • are you gettin any error message?

    – pollirrata
    Apr 12 '12 at 22:23






  • 1





    have you tried setting the class to "required" on an input element and see if that works? That's another way to declare rules. And as above, are you getting any console errors?

    – Daniel Hallqvist
    Apr 12 '12 at 22:29






  • 1





    What does "does not work" mean?

    – Sparky
    Apr 12 '12 at 22:37











  • Your code is working exactly as expected... jsfiddle.net/ex44R/1

    – Sparky
    Apr 12 '12 at 23:14



















  • are you gettin any error message?

    – pollirrata
    Apr 12 '12 at 22:23






  • 1





    have you tried setting the class to "required" on an input element and see if that works? That's another way to declare rules. And as above, are you getting any console errors?

    – Daniel Hallqvist
    Apr 12 '12 at 22:29






  • 1





    What does "does not work" mean?

    – Sparky
    Apr 12 '12 at 22:37











  • Your code is working exactly as expected... jsfiddle.net/ex44R/1

    – Sparky
    Apr 12 '12 at 23:14

















are you gettin any error message?

– pollirrata
Apr 12 '12 at 22:23





are you gettin any error message?

– pollirrata
Apr 12 '12 at 22:23




1




1





have you tried setting the class to "required" on an input element and see if that works? That's another way to declare rules. And as above, are you getting any console errors?

– Daniel Hallqvist
Apr 12 '12 at 22:29





have you tried setting the class to "required" on an input element and see if that works? That's another way to declare rules. And as above, are you getting any console errors?

– Daniel Hallqvist
Apr 12 '12 at 22:29




1




1





What does "does not work" mean?

– Sparky
Apr 12 '12 at 22:37





What does "does not work" mean?

– Sparky
Apr 12 '12 at 22:37













Your code is working exactly as expected... jsfiddle.net/ex44R/1

– Sparky
Apr 12 '12 at 23:14





Your code is working exactly as expected... jsfiddle.net/ex44R/1

– Sparky
Apr 12 '12 at 23:14












1 Answer
1






active

oldest

votes


















7














Your code, as you've posted it, is working as expected... jsFiddle DEMO



Regarding your code...



jQuery(document).ready(function() { 
//Home Validation
$("#quote").validate({
rules:{
companyName:{
required: true,
url: true
}
}
});
});


If you've put jQuery into noConflict mode, then your code in noConflict mode is broken.



When using noConflict mode, you must pass the $ symbol into the document.ready function. Working demo...



$.noConflict();
jQuery(document).ready(function($) {
$("#quote").validate({
// rules
});
});


OR, you'd use jQuery in place of $ everywhere. Working demo...



$.noConflict();
jQuery(document).ready(function() {
jQuery("#quote").validate({
// rules
});
});


Otherwise, without using no-conflict mode, it would just look like this. Working demo...



$(document).ready(function() {
$("#quote").validate({
// rules
});
});





share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10132725%2fjquery-validate-not-working%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    7














    Your code, as you've posted it, is working as expected... jsFiddle DEMO



    Regarding your code...



    jQuery(document).ready(function() { 
    //Home Validation
    $("#quote").validate({
    rules:{
    companyName:{
    required: true,
    url: true
    }
    }
    });
    });


    If you've put jQuery into noConflict mode, then your code in noConflict mode is broken.



    When using noConflict mode, you must pass the $ symbol into the document.ready function. Working demo...



    $.noConflict();
    jQuery(document).ready(function($) {
    $("#quote").validate({
    // rules
    });
    });


    OR, you'd use jQuery in place of $ everywhere. Working demo...



    $.noConflict();
    jQuery(document).ready(function() {
    jQuery("#quote").validate({
    // rules
    });
    });


    Otherwise, without using no-conflict mode, it would just look like this. Working demo...



    $(document).ready(function() {
    $("#quote").validate({
    // rules
    });
    });





    share|improve this answer






























      7














      Your code, as you've posted it, is working as expected... jsFiddle DEMO



      Regarding your code...



      jQuery(document).ready(function() { 
      //Home Validation
      $("#quote").validate({
      rules:{
      companyName:{
      required: true,
      url: true
      }
      }
      });
      });


      If you've put jQuery into noConflict mode, then your code in noConflict mode is broken.



      When using noConflict mode, you must pass the $ symbol into the document.ready function. Working demo...



      $.noConflict();
      jQuery(document).ready(function($) {
      $("#quote").validate({
      // rules
      });
      });


      OR, you'd use jQuery in place of $ everywhere. Working demo...



      $.noConflict();
      jQuery(document).ready(function() {
      jQuery("#quote").validate({
      // rules
      });
      });


      Otherwise, without using no-conflict mode, it would just look like this. Working demo...



      $(document).ready(function() {
      $("#quote").validate({
      // rules
      });
      });





      share|improve this answer




























        7












        7








        7







        Your code, as you've posted it, is working as expected... jsFiddle DEMO



        Regarding your code...



        jQuery(document).ready(function() { 
        //Home Validation
        $("#quote").validate({
        rules:{
        companyName:{
        required: true,
        url: true
        }
        }
        });
        });


        If you've put jQuery into noConflict mode, then your code in noConflict mode is broken.



        When using noConflict mode, you must pass the $ symbol into the document.ready function. Working demo...



        $.noConflict();
        jQuery(document).ready(function($) {
        $("#quote").validate({
        // rules
        });
        });


        OR, you'd use jQuery in place of $ everywhere. Working demo...



        $.noConflict();
        jQuery(document).ready(function() {
        jQuery("#quote").validate({
        // rules
        });
        });


        Otherwise, without using no-conflict mode, it would just look like this. Working demo...



        $(document).ready(function() {
        $("#quote").validate({
        // rules
        });
        });





        share|improve this answer















        Your code, as you've posted it, is working as expected... jsFiddle DEMO



        Regarding your code...



        jQuery(document).ready(function() { 
        //Home Validation
        $("#quote").validate({
        rules:{
        companyName:{
        required: true,
        url: true
        }
        }
        });
        });


        If you've put jQuery into noConflict mode, then your code in noConflict mode is broken.



        When using noConflict mode, you must pass the $ symbol into the document.ready function. Working demo...



        $.noConflict();
        jQuery(document).ready(function($) {
        $("#quote").validate({
        // rules
        });
        });


        OR, you'd use jQuery in place of $ everywhere. Working demo...



        $.noConflict();
        jQuery(document).ready(function() {
        jQuery("#quote").validate({
        // rules
        });
        });


        Otherwise, without using no-conflict mode, it would just look like this. Working demo...



        $(document).ready(function() {
        $("#quote").validate({
        // rules
        });
        });






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 12 '12 at 23:16

























        answered Apr 12 '12 at 22:45









        SparkySparky

        82.7k20151241




        82.7k20151241
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10132725%2fjquery-validate-not-working%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Xamarin.form Move up view when keyboard appear

            Post-Redirect-Get with Spring WebFlux and Thymeleaf

            Anylogic : not able to use stopDelay()