-
1. Re: Reset modalPanel
mail.micke Dec 14, 2007 7:30 AM (in response to panky_p)It is not really clear what you are doing, posting code might help us help you :)
If the modal panel gets the new "cleared" values from a backing bean, make sure that you reRender the modal panel correctly (not the modal panel itself, but its content).
This might help:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=125312 -
2. Re: Reset modalPanel
panky_p Dec 17, 2007 2:54 AM (in response to panky_p)Hi micke,
my modalPanel code is<rich:modalPanel id="newPanel" minHeight="200" minWidth="500" resizeable="false" height="200" width="550" zindex="2000"> <f:facet name="header"><h:outputText value="New Page" /></f:facet> <f:facet name="controls"> <h:graphicImage value="close.png" style="cursor:pointer" onclick="Richfaces.hideModalPanel('newPanel')" /> </f:facet> <h:form id="newForm"> <div> <h:outputLabel>Car Type </h:outputLabel> <table> <tr> <td><h:inputText id="carTitle" value="#{myCarBean.carTitle}"/></td> </tr> </table> <h:outputLabel>Car Make </h:outputLabel> <table> <tr> <td><h:inputText id="carMake" value="#{myCarBean.carMake}"/></td> </tr> </table> <table border="0" cellpadding="5" cellspacing="0" width="300" align="center"> <tr> <td align="center"> <h:commandButton type="submit" value=" Save " action="#{myCar.newCar()}"/> <h:commandButton type="button" value="Cancel" action="javascript:Richfaces.hideModalPanel('newPanel');return false;" /> </td> </tr> </table> </div> </h:form> </rich:modalPanel>
and for button<a4j:commandButton value="Add New Car" oncomplete="javascript:Richfaces.showModalPanel('newPanel',{width:520, top:'10px', left:'75px'});return false;"/>
when first time I click on Add New Car button it show modalPanel where i input values and save but when I click again on Add New Car button it shows modalPanel with old input values , but I want modalPanel should not contain previous input values!!
Thanks
Panky -
3. Re: Reset modalPanel
pankaj.ghosh Dec 17, 2007 2:09 PM (in response to panky_p)You must not be emptying the 'myCarBean' after first processing.
If that doesnt work(i dont know your complete logic), Do above step and also, put the contents of modal panel in a a4j:outputPanel and reRender it after first processing. -
4. Re: Reset modalPanel
panky_p Dec 18, 2007 1:13 AM (in response to panky_p)Hi Pankaj,
I did try to empty my bean but it affects other processing,
I also tried to empty only the fields which appear in modalPanel but no success,
put the contents of modal panel in a a4j:outputPanel is ok but after first processing how can I reRender it ? unless and until Add New Car button is not pressed?
I'm sorry but not much familiar with these things as I am beginner,
If you can explain where should I use reRender that will be great for me!!
Thanks!!
Pankaj P Dev -
5. Re: Reset modalPanel
bm97 Mar 28, 2008 8:45 AM (in response to panky_p)Trigger a refresh using the onHide-JS-function of the modalPanel. (The onShow-function is broken in 3.1.4 GA).
The property XXX of the Bean shall be set to a default value when calling Bean.setShallReInit().
Disadvantage: an additional Ajax-Request&Response<rich:modalPanel onhide="resetOnHide();" > <a4j:form id="#{formId}"> <a4j:jsFunction name="resetOnHide" reRender="#{formId}" > <a4j:actionparam name="shallReInit" value="true" assignTo="#{Bean.shallReInit}"/> </a4j:jsFunction> <h:outputText value="#{Bean.XXX}"/> </a4j:form> </rich:modalPanel>
Greetings