Forum Moderators: open

Message Too Old, No Replies

jquery plugin: Validation not working in ie7. Please help.

jquery, form, validation

         

jermaineamado

11:19 am on Jun 8, 2011 (gmt 0)

10+ Year Member


It does not work in ie7! Here is my code and my link... I have been trying to fix for 2 hours now! Please help. I tried using jquery 1.6.1, 1.5.2, min.validation, regular validation, i changed the buttons to input type="submit" and did everything else I could find but nothing works.

When you click submit, it does not validate. It goes straight to my thank you page and I get a blank form in return.

I do not know much jquery, just enough to know what I copy and paste and make some minimal changes. Thanks!

http://www.denver-website-designer.com/quote.html

<script type="text/javascript">
$().ready(function() {
var erroralert = $("#quoteForm").bind("invalid-form.validate", function() {
$("#erroralert");
});
});

$.metadata.setType("attr", "validate");

$.validator.addMethod("ninja", function(value) {
return value == "ninja";
}, 'Can a robot spell "ninja"');

$().ready(function() {
$("#quoteForm").validate({
errorContainer: $("#erroralert"),
rules: {
fullname: {
required:true,
minlength:2,
},
email: {
required:true,
email:true,
},
phone: {
required:true,
minlength:10,
maxlength:15,
},
pages: {
required:true,
minlength:1,
maxlength:10,
number:true
},
whyrate: {
required:true,
minlength:10,
},
ninja: "ninja",
},
messages: {
email: "Please enter a valid email address",
pages: "Numeric values only",
}
});
});
</script>

Fotiman

1:16 pm on Jun 8, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You've got too many commas, which cause the script to error.

$().ready(function () {
var erroralert = $("#quoteForm").bind("invalid-form.validate", function () {
$("#erroralert");
});
});

$.metadata.setType("attr", "validate");

$.validator.addMethod("ninja", function (value) {
return value == "ninja";
}, 'Can a robot spell "ninja"');

$().ready(function () {
$("#quoteForm").validate({
errorContainer: $("#erroralert"),
rules: {
fullname: {
required: true,
minlength: 2, // REMOVE THIS COMMA ***
},
email: {
required: true,
email: true, // REMOVE THIS COMMA ***
},
phone: {
required: true,
minlength: 10,
maxlength: 15, // REMOVE THIS COMMA ***
},
pages: {
required: true,
minlength: 1,
maxlength: 10,
number: true
},
whyrate: {
required: true,
minlength: 10, // REMOVE THIS COMMA ***
},
ninja: "ninja", // REMOVE THIS COMMA ***
},
messages: {
email: "Please enter a valid email address",
pages: "Numeric values only", // REMOVE THIS COMMA ***
}
});
});

jermaineamado

8:41 pm on Jun 8, 2011 (gmt 0)

10+ Year Member



wow! thank you soooo much! works great now! Can't believe it was so simple. I am about to start reading a book on jquery so hopefully I can troubleshoot any future problems faster. Thanks again!