2013-06-15 6 views
1

부트 스트랩을 사용하면 필요한대로 입력을 지정할 수 있으며 데이터 유형은 & 필수 패턴을 정의 할 수 있습니다. 슬프게도 IE 10 이전 버전의 IE에서는 작동하지 않습니다.IE의 부트 스트랩 입력 유효성 확인

아무도 IE 픽업이 가능하고 입력 값에 할당 된 속성을 읽으면 javascript 유효성 검사 플러그 인을 알 수 있습니까?

+0

확인 http://stackoverflow.com/questions/9067536/html5-forms-with-polyfills-is-it-worth-it을 (당신이 AJAX없이 원하는 경우 단순히 그 부분을 편집). 그것을 시도하거나 여기를보십시오 http://afarkas.github.com/webshim/demos/index.html. 그렇지 않으면 https://github.com/elclanrs/jq-idealforms 또는 http://jqueryvalidation.org/에서 확인할 수 있습니다. – elclanrs

답변

0

동일한 문제가 발생하여 다음 플러그인을 사용 했으므로 잘 작동합니다. AJAX로 뒤를

Official Plugin Page 

http://jqueryvalidation.org/

GitHub 

https://github.com/jzaefferer/jquery-validation

CDN 

http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js

EXAMPLE CODE: 

그것은 쉽게 사용될 수있다 :

<form id="example_form" action="process.php" method="POST" novalidate="novalidate"> 
<span style="display: none;" id="success">Success</span> 
<span style="display: none;" id="failure">Failure</span> 

<label for="Name">Name:<br> 
        <input type="text" id="txtName" required="" class="required"> 
       </label> 
<label for="Phone">Contact No:<br> 
        <input type="tel" id="txtPhone" required="" class="required number"> 
       </label> 
<label for="Email">Email:<br> 
        <input type="email" id="txtEmail" required="" class="required email"> 
       </label> 
<button type="submit">Submit</button> 
</form> 


    $(function() 
    { 

var form = $("#example_form").validate(); 
$("form#example_form").submit(function() { 
        if(form.valid()) 
        { 
         var name = $("#txtName").val(); 
         var email = $("#txtEmail").val(); 
         var phone = $("#txtPhone").val(); 

         $.ajax({ 
         url: "process.php", 
         type: "POST", 
         data: { 
           'name': name, 
           'email': email, 
           'phone': phone 
           }, 
         dataType: "json", 
         success: function(data) { 
           if(data.status == 'success') 
           { 
            $('#success').show(); 
           } 
           else if(data.status == 'error') 
           { 
            $('#failure').show(); 
           } 
          } 
         }); 
       return false; 
       } 
     }); 
}); 
관련 문제