i'm getting an error 'Object expected' for some odd reason due to jquery, and this does not 'submit' the form or enter the data into database.
without jquery, the data could be entered into the database. but now it doesn't.
i've used jquery mainly for validating asp.net controls.
roosteronacid, the validations are working perfectly fine and the id property is also the same. the submit is just not executing the server-side code and i cannot figure out what is the problem.
EDIT:
this is jquery code:
<script type="text/javascript">
$(document).ready(function() {
// add custom validation methods
$.validator.addMethod('phone', function(value, el, params) {
return this.optional(el) || /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/.test(value);
}, 'Please enter a valid phone number');
$.validator.addMethod('numbers', function(value, el, params) {
return this.optional(el) || /^[0-9]+$/.test(value);
}, 'Invalid entry. Only Numeric is allowed.');
$.validator.addMethod('domainurl', function(value, el, params) {
return this.optional(el) || /^(http\:\/\/(?:www\.)?[a-zA-Z0-9]+(?:(?:\-|_)[a-zA-Z0-9]+)*(?:\.[a-zA-Z0-9]+(?:(?:\-|_)[a-zA-Z0-9]+)*)*\.[a-zA-Z]{2,4}(?:\/)?)$/.test(value);
}, 'Please enter a valid domain url');
$.validator.addMethod('selectone', function(value, element) {
return this.optional(element) || (value.indexOf("none") == -1);
}, 'Please select an option.');
$("#form1").validate({
debug: true,
rules: {
txt_name: {
required: true,
minlength: 2
},
txt_cmp: {
required: true,
minlength: 2
},
txt_tel1: {
phone: true,
required: true,
minlength: 3
},
txt_tel2: {
phone: true,
required: false,
minlength: 3
},
txt_mob: {
phone: true,
required: false,
minlength: 9
},
txt_email: {
required: true,
email: true
},
txt_domname: {
required: true,
domainurl: true
},
radiobt_domain: "required",
ddl_yremail: {
required: true,
selectone: true
},
ddl_email: {
required: true,
selectone: true
},
txt_space: {
required: true,
numbers: true
},
txt_calfr: {
required: true
},
txt_calto: {
required: true
}
},
messages: {
txt_name: {
required: "This field is required",
minLength: "Please enter a valid name"
},
txt_cmp: {
required: "This field is required",
minLength: "Please enter a valid commpany name"
},
txt_tel1: {
required: "This field is required",
minLength: "Please enter a valid telephone number"
},
txt_tel2: {
minLength: "Please enter a valid telephone number"
},
txt_mob: {
minLength: "Please enter a valid mobile number"
},
txt_email: {
email: "Please enter a valid email address",
required: "This field is required"
},
txt_domname: {
required: "This field is required"
},
radiobt_domain: "Select the Hosting Type"
}
});
});
</script>
is there anything wrong with the code?
it says object expected at line 559. i checked the jquery.validate.js file and this is the code it shows:
addWrapper: function(toToggle) {
if ( this.settings.wrapper )
toToggle = toToggle.add( toToggle.parents( this.settings.wrapper ) );
return toToggle;
}
the jquery code displays all the errors at the right places, but once corrected, it doesn't submit the data.
the plugin i am using:
http://bassistance.de/jquery-plugins/jquery-plugin-validation/