2011-08-27 1 views

답변

1

우리는 Jquery 유효성 검사 플러그인을 사용하여 이와 비슷한 작업을 수행했습니다. 이를 위해 처음에는 팝업 div를 만들어야합니다.

자바 스크립트 FN

$("#formID").validate({ 
     submitHandler: function (form) { 
      CallFunction(); 
     }, 

     highlight: function (element, errorClass) { 
      HidePopup(element); 
      ShowPopup(element); 
     }, 

     unhighlight: function (element, errorClass) { 
      HidePopup(element); 
     }, 

     errorElement: "span", 

     errorPlacement: function (error, element) { 
      error.appendTo(element.prev("label")); 
     }, 

     rules: { 
      txtName:"required" 
     } 
}); 

function ShowPopup(paramElement) 
{ 
    //function to show popup and position div accordingly 
    $('#div'+paramElement.Id).show(); 
} 

function HidePopup(paramElement) 
{ 
    //function to hide popup 
    $('#div'+paramElement.Id).hide(); 
} 



**Html** 


<form id="formID" action=""> 

    <input name="txtName" type="text" id="txtName" /> 
    <div id="divtxtName" >Please enter name</div> 

</form>