2013-12-11 4 views
-1

양식 페이지가 있습니다. 그러나 양식 페이지가 인 경우 IE7의 유효성을 검사하지 않습니다. 콘솔에 오류 메시지가 표시되지 않습니다. 그것은jquery 유효성 검사 플러그인이 IE7에서 작동하지 않습니다.

내 JS 코드는 버튼 타입은 IE7에 대해서는에서

button id="submit" name="submit" class="btn btn-primary center-block" title="SUBMIT ENTRY" type="submit">SUBMIT ENTRY</button> 

를 제출 추가하여 문제 해결

$(document).ready(function() { 

/* clear the form values when refreshed or reload*/ 
    function ClearForm() { 
    document.submitDetails.reset(); 
    } 
    $("input:not(':button, :submit, :reset, :hidden')").val('').checked = false; 
/*pretty chekable*/ 
    /*$('input.prettyCheckable').prettyCheckable({}); */ 

/*rulesets for validations*/ 
    var ruleSet1 = { 
    required: true, 
    maxlength: 120, 
    email: true 
    }; 
    var ruleSet2 = { 
    required: true, 
    maxlength: 80 
    }; 
    var ruleSet3 = { 
    required: true, 
    maxlength: 10, 
    minlength: 8, 
    number: true 
    }; 
    var ruleSet4 = { 
    required: true, 
    maxlength: 4, 
    minlength: 4, 
    number: true 
    }; 
    var ruleSet5 = { 
    required: true, 
    maxlength: 2, 
    minlength: 2, 
    number: true 
    }; 




$('#custom8').on('change', function() { 
    this.value = this.checked ? 1 : 0; 
}).change(); 
$('#custom9').on('change', function() { 
    this.value = this.checked ? 1 : 0; 
}).change(); 
$('#custom8').on('change', function(){ 
    $(this).valid() 
}) 
$('#custom9').on('change', function(){ 
    $(this).valid() 
}) 


    $('#submitDetails').validate({ 
/*if need to show error # message at top */ 
    /* showErrors: function(errorMap, errorList) { 
      $("#messageBox").html("This form contains " 
      + this.numberOfInvalids() 
      + " errors, see details below."); 
      this.defaultShowErrors(); 
      },*/ 
    // onfocusout: true, onkeyup: true, onclick:true, focusCleanup: true, 
    // 1. validation rules. 
    rules: { 
     firstName: ruleSet2, 
     lastName: ruleSet2, 
     address: ruleSet2, 
     suburb: ruleSet2, 
     state: { 
     required: true 
     }, 
     mobile: ruleSet3, 
     postCode: ruleSet4, 
     email: ruleSet1, 
     custom1: { 
     required: true 
     }, 
     custom2: { 
     required: true, 
     number: true, 
     min: 30 
     }, 
     custom3: { 
     required: true 
     }, 
     custom4: { 
     required: true 
     }, 
     custom5: { 
     required: true 
     }, 
     custom6: { 
     required: true, 
     maxlength: 2, 
     minlength: 2, 
     number: true, 
     min: 00, 
     max: 23 
     }, 
     custom7: { 
     required: true, 
     maxlength: 2, 
     minlength: 2, 
     number: true, 
     min: 00, 
     max: 60 
     }, 
     custom8:{ 
      required: true 
     } 
    },  
    groups: { 
     time: "custom6 custom7", 
     date: "custom3 custom4 custom5" 
    }, 
    errorPlacement: function (error, element) { 
     if (element.attr("name") == "custom2") 
     error.appendTo(".errorPurchase"); 
     else if ((element.attr("name") == "custom6") || (element.attr("name") == "custom7")) 
     error.appendTo(".errorTime"); 
     else if ((element.attr("name") == "custom8")) 
      error.appendTo("#error_msg");  
     else if ((element.attr("name") == "custom3") || (element.attr("name") == "custom4") || (element.attr("name") == "custom5")) 
     error.appendTo(".errorDate"); 
     else 
     error.insertAfter(element); 
    }, 
    messages: { 
     firstName: "Please enter your first name", 
     lastName: "Pleae enter your last name", 
     address: "Please enter your street address", 
     mobile: "Please enter valid 10 digit phone number (including area code for landline)", 
     postCode: "Please enter the 4 digits of your post code", 
     state: "Please select the store's state where you made your purchase", 
     email: "Please enter a valid email address", 
     custom2: "Total amount must be exact to the cent - minimum $30", 
     custom6: "Please enter the time (hours and minutes) found on your receipt in the format hh:mm. For example if 9:05am, please enter 09 in first field and 05 in second field.", 
     custom7: "Please enter the time (hours and minutes) found on your receipt in the format hh:mm. For example if 9:05am, please enter 09 in first field and 05 in second field.", 
     custom3: "Sorry, the date you have selected does not exist. Please check and try again", 
     custom4: "Sorry, the date you have selected does not exist. Please check and try again", 
     custom5: "Sorry, the date you have selected does not exist. Please check and try again", 
     suburb: "Please enter your town/suburb", 
     custom1: "Please select the store you made your purchase", 
     custom8: "You need to agree to participate in this competition" 
    } 
    }); 

///execute when submit button is clicked 
$("#submit").click(function() { 
    if (document.getElementById("custom8").checked) { 
     document.getElementById('custom8Hidden').disabled = true; 
    } 
    if (document.getElementById("custom9").checked) { 
     document.getElementById('custom9Hidden').disabled = true; 
    }  

}); 
}); 
+0

'onclick','onfocusout' 및'onkeyup' 옵션 **은 디폴트 연산이고'true'가 내장 함수를 깨뜨리지 않기 때문에 ** 반드시'true'로 설정해서는 안됩니다. 자신의 확인을 위해 설명서를 참조하십시오. – Sparky

+0

참으로 설정되지 않았습니다. 당신이 볼 수 있듯이 js 파일의 해당 줄은 주석으로 처리되었습니다. –

+0

IE7을 제외한 모든 브라우저에서 작동한다는 것을 반복해서 말합니다. –

답변

-1

아래 ... 다른 모든 브라우저에서 유효성을 검사 한 버튼을 추가 할 필요가 submit을 입력하십시오. 알고 있었어. 이 시간을 잊어 버렸습니다. 그것은 해결되었습니다.

관련 문제