Hi,
I have a datagrid in which there are pictures about products. When the user clicks on a picture it gives a modalPanel to enter qty. Once the user enter the qty and click add, it goes back to the previous page, where the user can select a different product to enter qty again.
But when the user clicks on a different product, it shows the modalPanel with the previous qty entered. I want that qty to be cleared before the user enters the qty for the new product. I used reRender but it doesnt help.
<head>
<title> The Shop</title>
</head>
<body>
<rich:modalPanel id="modalPanel">
<f:facet name="header">
Enter Qty
</f:facet>
<h:form>
<h:panelGrid>
<h:outputText value="Enter Qty: " />
<h:inputText id ="qty" value="#{orderBean.qty}" />
<h:panelGroup>
<a4j:commandButton value="Add" id="add" action="#{orderBean.addProduct}" reRender="form"
oncomplete="Richfaces.hideModalPanel('modalPanel')" >
</a4j:commandButton>
<a4j:commandButton value="Back" id="back"
oncomplete="Richfaces.hideModalPanel('modalPanel')" />
</h:panelGroup>
</h:panelGrid>
</h:form>
</rich:modalPanel>
<br/>
<br/>
<f:view>
<h:form id= "form">
<h:outputText value="Choose Your Product" style="font-style: italic; font-size: 1.4em"/>
<br/>
<br/>
<rich:dataGrid id="info" border="0" value="#{productBean.productList}" var="product" columns ="2" >
<h:panelGrid id = "myDataGrid" border="0" columns="2">
<a4j:commandLink onclick="#{rich:component('modalPanel')}.show()"><h:graphicImage value="/images/#{product.imageName}" />
<a4j:actionparam name="productID" value="#{product.productID}" assignTo="#{orderBean.productID}"/>
</a4j:commandLink>
<h:outputText value=" $ #{product.price}" />
</h:panelGrid>
</rich:dataGrid>
<br/>
<br/>
<a4j:commandButton value="Back" id="back" reRender="qty"
oncomplete="Richfaces.hideModalPanel('modalPanel2')" />
</h:form>
</p>
</f:view>
</body>
</html>
Appreciate your help!