2013-05-20 52 views
0

我有兩個一個xhtml。但是他們兩個都不能正常工作。 當我點擊保存按鈕時,導入按鈕的confirmDialog出現了。 當我點擊導入按鈕時,什麼都沒有出現。 有什麼我錯過了?兩個<p:confirmDialog>在一個xhtml中

   <td><p:commandButton type="button" 
       value="Save" id="cr1002_command_save" 
       onclick="confirmation.show()" ajax="false" 
       style="width: 80px;height: 24px"> 
       </p:commandButton> <p:confirmDialog id="confirmDialog" 
       message="#{msg.cr1002_prompt_confirm_save}" severity="alert" 
       widgetVar="confirmation" style="width: 70px;height: 27px"> 
       <p:commandButton id="confirm" value="OK" 
        oncomplete="confirmation.hide()" 
        action="#{pc_Cr1002.doCr1002_command_saveAction}" ajax="false" 
        style="width: 80px;height: 24px" /> 
       <p:commandButton id="decline" value="Cancel" 
        onclick="confirmation.hide()" type="button" 
        style="width: 80px;height: 24px" /> 
       </p:confirmDialog></td> 
      <td></td> 
      <td><p:commandButton type="button" 
       value="Import" 
       onclick="gowait('form1:cr1002_command_import')" 
       id="cr1002_command_import" ajax="false" 
       style="width: 80px;height: 24px"></p:commandButton> 
        <p:confirmDialog id="confirmDialog2" 
       message="Importing... Importing..." severity="alert" 
       widgetVar="confirmation" style="width: 70px;height: 27px"> 
       <p:commandButton id="confirm2" value="OK" 
        oncomplete="confirmation.hide()" 
        action="#{pc_Cr1002.doCr1002_command_importAction}" ajax="false" 
        style="width: 80px;height: 24px" /> 
       <p:commandButton id="decline2" value="Cancel" 
        onclick="confirmation.hide()" type="button" 
        style="width: 80px;height: 24px" /> 
       </p:confirmDialog> 
      </td> 

回答

3

來自同一widgetVar attribute的問題,在客戶端這個屬性的使用,這導致客戶端衝突,你應該如下代碼爲:

<td><p:commandButton type="button" 
       value="Save" id="cr1002_command_save" 
       onclick="confirmation.show()" ajax="false" 
       style="width: 80px;height: 24px"> 
       </p:commandButton> <p:confirmDialog id="confirmDialog" 
       message="#{msg.cr1002_prompt_confirm_save}" severity="alert" 
       widgetVar="confirmation" style="width: 70px;height: 27px"> 
       <p:commandButton id="confirm" value="OK" 
        oncomplete="confirmation.hide()" 
        action="#{pc_Cr1002.doCr1002_command_saveAction}" ajax="false" 
        style="width: 80px;height: 24px" /> 
       <p:commandButton id="decline" value="Cancel" 
        onclick="confirmation.hide()" type="button" 
        style="width: 80px;height: 24px" /> 
       </p:confirmDialog></td> 
      <td></td> 
      <td><p:commandButton type="button" 
       value="Import" 
       onclick="confirmation2.show()" 
       id="cr1002_command_import" ajax="false" 
       style="width: 80px;height: 24px"></p:commandButton> 
        <p:confirmDialog id="confirmDialog2" 
       message="Importing... Importing..." severity="alert" 
       widgetVar="confirmation2" style="width: 70px;height: 27px"> 
       <p:commandButton id="confirm2" value="OK" 
        oncomplete="confirmation.hide()" 
        action="#{pc_Cr1002.doCr1002_command_importAction}" ajax="false" 
        style="width: 80px;height: 24px" /> 
       <p:commandButton id="decline2" value="Cancel" 
        onclick="confirmation.hide()" type="button" 
        style="width: 80px;height: 24px" /> 
       </p:confirmDialog> 
      </td> 
+0

嘿嘿,謝謝!得到它的工作。 (: – hahagal

+0

@hahagal不客氣,你應該標記爲答案來關閉你的問題! –

相關問題