-1

I have an edit buttton on a search result page, That button whenever pushed should prompt the user to enter a date prior to continuing on to the next page.

Button without the modal feature:

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

Somehow I would like to introduce a modal diaglog prior to opening the page to get the entered date from the model dialog and pass it to the open method, something like:

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

I have SEAM 2.2, JSF and Richfaces available to me. Not sure how to best to meet this need.

What I have accomplished so far: Altered the button to open a modal dialog.

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

Setup the modal dialog:

<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>

But now I do not know how to capture the date entered.

Brian
  • 13,412
  • 10
  • 56
  • 82

1 Answers1

1

Could you not move your first action into your modal panel? So instead of having in your modal panel:

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

you have something like:

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

It will have to be inside a form to work. The first button to open the modal panel could just be used to show the panel and not have any action called. If the modal form is not inside the same form as the first button then you could set your properties in first form on showing the modal panel maybe by using the f:setPropertyActionListener?

Ross
  • 3,008
  • 1
  • 22
  • 27
  • Giving it a try will let you know. Thanks. – Brian Aug 20 '11 at 00:55
  • I think I was hung up trying to make enteredDate a parameter to the method and couldn't figure out how to grab the date to include in the call to open. But you are right, the modal dialog now has the action attribute and it is working and I just made enteredDate a property of the controller. – Brian Aug 24 '11 at 01:46