jQuery Validate Not Working
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
add a comment |
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
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
add a comment |
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
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
jquery jquery-validate
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
});
});
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
});
});
add a comment |
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
});
});
add a comment |
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
});
});
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
});
});
edited Apr 12 '12 at 23:16
answered Apr 12 '12 at 22:45
SparkySparky
82.7k20151241
82.7k20151241
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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