我已經設置了一些基於從下拉框中選擇項目來驗證字段的自定義規則。jQuery驗證不在IE7中工作,但在IE8中工作
我在下拉
3個值- 請選擇
- 沒有表現出
- 拒絕
如果用戶選擇「沒有表現出」一個datepicker出現,他們必須輸入有效日期 如果用戶選擇「拒絕」,則會出現另一個下拉列表,用戶必須從中選擇一個值
問題是它在IE8中工作,但不在IE7中。想法?
我已經設置如下;
this.SetupValidations = function() {
//validations
LLNP4.validate('#uxReferralAssessmentDetailsForm',
{
rules: {
assessmentDecision: { requiredSelect: "0" },
NoShowDate: { required: othis.clientDidNotShowValidation },
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);
}
謝謝。試過了,這可能是很好的標準。不幸的是沒有做任何事情。 – kurasa 2010-01-28 00:16:51