jquery validation not working in IE7 but does work in IE8
I have setup some custom rules for validating a field based on whether an item is selected from a drop down box.
I have 3 values in the drop down
- Please Select
- Did Not Show
- Declined
If the user selects "Did not show" a datepicker appears and they have to enter a valid date If the user selects "decline" another drop down appears and the user has to select a value from it
The problem is that it work in IE8 but not in IE7. Ideas?
I have set this up as follows;
this.SetupValidations = function() {
//validations
LLNP4.validate('#uxReferralAssessmentDetailsForm',
{
rules: {
assessmentDecision: { requiredSelect: "0" },
NoShowDate: { required: othis.cl开发者_运维百科ientDidNotShowValidation },
DeclinedReason: { requiredSelect: othis.clientDeclinedValidation }
}
});
}
this.clientDidNotShowValidation = function() {
if ($("#uxassessmentDecision option:selected").text().toUpperCase() == "DID NOT SHOW")
{ return true; }
else
{ return false; }
}
this.clientDeclinedValidation = function() {
if ($("#uxassessmentDecision option:selected").text().toUpperCase() == "DECLINED")
{ return "0"; }
else
{ return "1"; }
}
this.ValidateReferralAssessmentSubmission = function() {
othis.SetupValidations();
if ($("#uxReferralAssessmentDetailsForm").valid()) {
return true;
}
else {
return false;
}
}
this.OnAssessmentSave = function () {
//post back to the server and update the assessment details
var options = {
target: '',
url: '../Referral/UpdateReferralAssessmentDetails',
data: { ReferralId: referralIdentifier },
beforeSubmit: othis.ValidateReferralAssessmentSubmission,
dataType: 'json',
success: othis.UpdateReferralAssessmentStatus,
clearForm: true
};
$('#uxReferralAssessmentDetailsForm').ajaxSubmit(options);
}
Maybe if you insert a ; at end of every function, like this:
this.SetupValidations = function() {
//validations
LLNP4.validate('#uxReferralAssessmentDetailsForm',
{
rules: {
assessmentDecision: { requiredSelect: "0" },
NoShowDate: { required: othis.clientDidNotShowValidation },
DeclinedReason: { requiredSelect: othis.clientDeclinedValidation }
}
});
};
There's a typo?
othis.SetupValidations();
Isn't "this" instead "othis"?
精彩评论