2011-04-10 5 views
0

IE를 실행하고 발행하여 입력 키를 눌러 양식을 제출할 수 없도록합니다. 부분 솔루션 (http://www.thefutureoftheweb.com/blog/submit-a-form-in-ie-with-enter)을 찾았지만 대화 상자 창이 닫힙니다. 내 유효성 검사가 실행되고 오류 메시지가 표시됩니다. 내 대화창을 어떻게 열어 두겠습니까?IE Primefaces Enter 키 제출 해결 방법

<p:dialog id="sgupdlg" header="#{bundle['signUp.HEADER']}" widgetVar="signUpDlg" 
     modal="true" styleClass="dialog dialog1" draggable="false" 
     resizable="false" showEffect="fade" hideEffect="fade" position="top"> 
     <h:form id="signUpFrm" binding="#{signUpDetail.signUpFrm}"> 
     <p:growl id="growl" showDetail="true" showSummary="false" life="3000" errorIcon="/images/Validation-Error.png" infoIcon="/images/Validation-Success.png"/> 

     <p:inputText value="#{signUpDetailBean.firstName}" name="nameInput" required="true" requiredMessage="First Name is Required"/> 
     <p:inputText value="#{signUpDetailBean.lastName}" required="true" requiredMessage="Last Name is Required"/> 

     <p:commandButton styleClass="form-btn2" 
         value="#{bundle['signUp.button.LABEL']}" actionListener="#{signUpDetail.signUp}" onclick="trackingSignUpOverlaySave()" 
         oncomplete="handleSignUpRequest(xhr, status, args)" update="growl"/> 
     <p:commandButton type="reset" styleClass="close" /> 

     </h:form> 
    </p:dialog> 
    <script type="text/javascript"> 


     $ = jQuery 
     $(function(){ 
      $('input').keydown(function(e){ 
       if (e.keyCode == 13) { 
        $('#signUpFrm').submit(); 
        return false; 
       } 
      }); 
     }); 


    </script> 

답변

0
function closeWhenValidationSuccesful(dialog, xhr, status, args) { 
    if (!args.validationFailed) { 
     dialog.hide(); 
    } 
} 

<p:commandButton value="Save" action="doSomething" update=":formName:panelContainingValidatedElements" 
    oncomplete="closeWhenValidationSuccesful(dialogWidgetVar, xhr, status, args)" /> 

가 나는 대화 열고 디스플레이 유효성 검사 오류를 유지하려면 다음을 사용합니다. update 속성으로 대상이 될 수 있도록 입력을 panelGrid로 이동해야합니다.

0

간단한 태그로 해결할 수 있습니다.

의 onComplete = "(args.validationFailed는) {} 다른 {Professor.show(), Student.hide는();} 경우"

당신은 교수에게 에 위젯 VAR

이것을 적용하는 가정
관련 문제