2016-07-28 2 views
0

で成功した検証に私はconfirm dialogコールP:confirmDialogのみJSF

<p:confirmDialog global="true" showEffect="fade" hideEffect="fade" header="Modal Dialog" modal="true" width="430" height="120" > 
      <p:commandButton value="Ok" type="button" styleClass="ui-confirmdialog-yes myButton" icon="ui-icon-check" style="float:right;font-family:verdana, Arial; font-size:10pt; color:#ffffff; font-weight:bold;text-align:center;"/> 
      <p:commandButton value="Cancel" type="button" styleClass="ui-confirmdialog-no myButton" icon="ui-icon-close" style="float:right;font-family:verdana, Arial; font-size:10pt; color:#ffffff; font-weight:bold;text-align:center;"/> 
     </p:confirmDialog> 

次と次のような確認を呼び出している、

<p:commandLink style="text-decoration: none;" global="false" action="#{resetPasswordWindowController.changePassword()}" update="@form" > 
         <p:panelGrid id="loginButtonGrid" layout="tabular" styleClass="loginButtonGrid" > 
          <p:row styleClass="loginButtonGridRow"> 
           <p:column styleClass="loginButtonGridText lighterGreenBackground roundLeftCorners" > 
             Reset 
           </p:column> 
          </p:row> 
         </p:panelGrid> 
         <p:confirm header="Reset Password" message="Are you sure?" icon="ui-icon-alert" /> 
        </p:commandLink> 

私は予想通りそれが正常に動作しますが、確認サーバー側の検証が行われる前にダイアログが呼び出されます。

私の場合、私はパスワードを検証してパスワードの変更を確認しようとしており、ユーザーが実際に変更したいことを確認する警告を出そうとしています。

Expected Results would be : 

1. Validate the password and confirm password and if they are valid only show the confirm dialog and proceed to save based on the confirmation we get from confirm dialog. 

Thanks 

答えて

0

あなたは(少なくとも)2つのオプションがあります。

  1. は、AJAXを介してサーバにパスワードフィールドを送信し、その往復で行う検証を持っています。 「OK」をクリックするとcommandLinkが有効になり、コマンドリンクにconfirmDialogが設定されます。

  2. confirmDialogではなく、通常のダイアログを使用します。ここでのようには検証がない場合のcommandLinkをクリック上のそれは示されています:How to display dialog only on complete of a successful form submit

私は個人的にオプション1

を好みます
関連する問題