Thanks Volker. That solved my problem.
Ben.
Volker Weber-5 wrote:
>
> Hi ben,
>
> you don't need multiple popups, just alternate content in on popup. e.g.:
>
>
> <f:facet name="popup">
> <tc:popup width="150" height="100" id="popup"
> rendered="#{InputScreenBean.showPopup1 ||
> InputScreenBean.showPopup2}">
> <tc:panel>
> <f:facet name="layout">
> <tc:gridlayout rows="1*;1*"/>
> </f:facet>
> <tc:panel rendered="#{InputScreenBean.showPopup1}">
> <!-- content of first option -->
> </tc:panel>
> <tc:panel rendered="#{InputScreenBean.showPopup2}">
> <!-- content of second option -->
> </tc:panel>
> </tc:panel>
> </tc:popup>
> </f:facet>
>
>
>
> Regards,
> Volker
>
>
>
>
> 2008/5/20 ben_p <[EMAIL PROTECTED]>:
>>
>> Hi All,
>> I am again struggling with popups. I have a submit button which when
>> clicked
>> does an initial pass of a database and calculates the number of results
>> that
>> would be returned. If this number is (e.g) > 50 but < 100 I want a
>> warning
>> popup with the option of continuing or cancelling. if the number > 100 I
>> want a popup that informs the user to selection is too large. This last
>> popup would have a single OK button and would cancel the transaction.
>>
>> My problem is I can get a single popup to work. But I cannot get two
>> popups
>> to be associated with my submit button. I have been playing around with
>> the
>> facet name and the popup rendered attribute but without success. I cannot
>> get popup2 to be displayed. Only the first popup is displayed.
>>
>> Note the facet names in the below code. There is popup and popup2. If
>> they
>> are both 'popup 'then JSF throws an exception. Only the one with the name
>> 'popup' will be displayed, but I have seen sample code on this forum
>> where
>> the facet name is set to 'popup1' and 'popup2'.
>>
>> <tc:button label="Open Popup" action="#{InputScreenBean.submit}"
>> id="myButtonId">
>>
>> <f:facet name="popup">
>> <tc:popup width="150" height="100" id="popup1"
>> rendered="#{InputScreenBean.showPopup1}">
>> <tc:box label="Popup Title 1">
>> <tc:panel>
>> <f:facet name="layout">
>> <tc:gridLayout rows="1*;fixed;" columns="1*;1*" />
>> </f:facet>
>> <tc:cell spanX="2">
>> <tc:out value="Over 100 results returned"></tc:out>
>> </tc:cell>
>> <tc:button label="OK" action="#{InputScreenBean.popupAction1}">
>> <tc:attribute name="popupClose" value="afterSubmit" />
>> </tc:button>
>> <tc:button label="Cancel">
>> <tc:attribute name="popupClose" value="immediate" />
>> </tc:button>
>> </tc:panel>
>> </tc:box>
>> </tc:popup>
>> </f:facet>
>>
>> <f:facet name="popup2">
>> <tc:popup width="150" height="100" id="popupId_2"
>> rendered="#{InputScreenBean.showPopup2}">
>> <tc:box label="Popup Title 2">
>> <tc:panel>
>> <f:facet name="layout">
>> <tc:gridLayout rows="1*;fixed;" columns="1*;1*" />
>> </f:facet>
>> <tc:cell spanX="2">
>> <tc:out value="Hooray 2nd popup shown"></tc:out>
>> </tc:cell>
>> <tc:button label="OK" action="#{InputScreenBean.popupAction2}">
>> <tc:attribute name="popupClose" value="afterSubmit" />
>> </tc:button>
>> <tc:button label="Cancel">
>> <tc:attribute name="popupClose" value="immediate" />
>> </tc:button>
>> </tc:panel>
>> </tc:box>
>> </tc:popup>
>> </f:facet>
>> </tc:button>
>>
>> Relevant InputScreenBean.java code:
>>
>> public String popupAction1() {
>> System.out.println("in popupAction1");
>> showPopup1 = false;
>> return "success";
>> }
>>
>> public String popupAction2() {
>> System.out.println("in popupAction");
>> return "success";
>> }
>>
>> public String submit() {
>> try {
>> int maxAllowed = 100;
>> int maxWarnings = 50;
>> showPopup1 = false;
>> showPopup2 = false;
>>
>> System.out.println("numResults is " + numResults);
>> //if numResults > maxAllowed the popup
>> //is show, if it is only > maxWarnings no
>> //popup is shown
>>
>> int iNumRes = Integer.parseInt(numResults);
>> if (iNumRes > maxAllowed) {
>> showPopup1 = true;
>> return null;
>> } else if (iNumRes > maxWarnings) {
>> showPopup2 = true;
>> return null;
>> }
>> } catch (Exception e) {
>> System.out.println("Error in submit()");
>> e.printStackTrace();
>> return "failure";
>> }
>>
>> return "success";
>> }
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-Tobago--choosing-popup-to-display-tp17338603p17338603.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> inexso - information exchange solutions GmbH
> Bismarckstraße 13 | 26122 Oldenburg
> Tel.: +49 441 4082 356 |
> FAX: +49 441 4082 355 | www.inexso.de
>
>
--
View this message in context:
http://www.nabble.com/-Tobago--choosing-popup-to-display-tp17338603p17344810.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.