2013-05-20 31 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不客气,你应该标记为答案来关闭你的问题! –

相关问题