2011-08-19 40 views
-1

我在搜索結果頁面上有一個編輯按鈕,每按一次該按鈕都會提示用戶在繼續進入下一頁之前輸入日期。如何捕獲在rich:modalpanel中輸入的輸入?

按鈕不具備模態特性:

<h:commandButton action="#{controller.open(rec, false)}" /> 

不知怎的,我想打開頁面以獲取從模型對話框中輸入的日期,並把它傳遞給open方法之前引入一個模式diaglog,像這樣:

<h:commandButton onClick="openAModelDialog()" 
action="#{controller.open(rec, false, enteredDate)}" /> 

我有SEAM 2.2,JSF和Richfaces可用給我。不知道如何最好地滿足這種需求。

我到目前爲止完成的工作: 更改了按鈕以打開模式對話框。

<a4j:commandButton onclick="#{rich:component('mp')}.show(); return false;" 
action="#{controller.open(rec, false)}" /> 

設置模式對話框:

<rich:modalPanel id="mp" minHeight="300" minWidth="450"> 
    <f:facet name="header"> 
     <h:outputText value="Enter Signature Date" /> 
    </f:facet> 
     <table> 
     <tr> 
     <td>Enter Signature Date:</td> 
     <td> 
     <rich:calendar disabled="#{readOnly}" 
       enableManualInput="false" converterMessage="'Signature Date' must be a date." 
       datePattern="MM/dd/yyyy" 
       value="#{searchController.enteredSignatureDate}" 
       ajaxSingle="false" showWeekDaysBar="false" showWeeksBar="false" 
       requiredMessage="Please provide the Signature Date."/> 
     <input type="button" onclick="#{rich:component('mp')}.hide()" value="Enter" /> 
     </td> 
     </tr> 
     </table> 
</rich:modalPanel> 

但現在我不知道如何捕捉輸入的日期。

回答

1

難道你不能將你的第一個動作移動到你的模態面板?因此,而不是在你的模式面板:

<input type="button" onclick="#{rich:component('mp')}.hide()" value="Enter" /> 

你有這樣的:

<a4j:commandButton oncomplete="#{rich:component('mp')}.hide()" action="#{controller.open(rec, false)}" value="Enter" /> 

它必須是一個內部形式的工作。打開模式面板的第一個按鈕只能用於顯示面板,不能調用任何操作。如果模態窗體不在第一個按鈕的同一窗體中,那麼您可以通過使用f:setPropertyActionListener來顯示模態面板,以第一種形式設置屬性。

+0

試一試會讓你知道。謝謝。 –

+0

我想我已經掛了,試圖讓enterDate方法的一個參數,並無法弄清楚如何獲取日期以包含在打開的調用中。但是你是對的,模態對話框現在具有action屬性,它正在工作,我只是使enteredDate成爲控制器的一個屬性。 –