2010-01-27 154 views
0

我已經設置了一些基於從下拉框中選擇項目來驗證字段的自定義規則。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); 

    } 

回答

0

也許如果你插入一個;在每個函數結束時,像這樣:

this.SetupValidations = function() { 
      //validations 
      LLNP4.validate('#uxReferralAssessmentDetailsForm', 
       { 
      rules: { 
       assessmentDecision: { requiredSelect: "0" }, 
       NoShowDate: { required: othis.clientDidNotShowValidation }, 
       DeclinedReason: { requiredSelect: othis.clientDeclinedValidation } 
        } 
       }); 
      }; 
+0

謝謝。試過了,這可能是很好的標準。不幸的是沒有做任何事情。 – kurasa 2010-01-28 00:16:51

0

有一個錯字?

othis.SetupValidations(); 

是不是「this」而不是「othis」?

+0

謝謝。不,我使用這種方法來構造暗算器,例如 function referralEdit()var decision; var othis = this; } – kurasa 2010-01-28 03:06:50

相關問題