Absente
asked on
JSF pass parameter to another form
Hi.
I have a jsf table and table has a column to delete item.
I have 2 form in my pafe.
first form for table.
the second form for tha dialog.
I want to this.
Ehen i clik button where in the datatable, the confirmation dialog show selected rows value.
My page
<h:form>
table
</h:form>
<h:form>
dialog
</h:form>
How can i pass parameter first form to second form.
I want to do this without refreshing page.
How can i do this ?
I have a jsf table and table has a column to delete item.
I have 2 form in my pafe.
first form for table.
the second form for tha dialog.
I want to this.
Ehen i clik button where in the datatable, the confirmation dialog show selected rows value.
My page
<h:form>
table
</h:form>
<h:form>
dialog
</h:form>
How can i pass parameter first form to second form.
I want to do this without refreshing page.
How can i do this ?
if you show you HTML source then i can show you how to pass parameters from one form to another form.right click on the dispLayed HTML page and click view source and paste it here.
ASKER
<p:panel id="editCategoryPanel"
rendered="#{userLogin.isAdmin()== true}" align="center"
style="text-align:center;">
<h:form id="form">
<p:dataTable id="categoriesTable" var="cat"
value="#{Categories.catList}" rowKey="#{cat.id}"
paginator="true" rows="10" paginatorPosition="bottom"
tableStyle="width:100%" selectionMode="single">
<f:facet name="header">
Categories
</f:facet>
<p:column headerText="ID">
<h:outputText value="#{cat.id}" />
</p:column>
<p:column headerText="Year">
<h:outputText value="#{cat.name}" />
</p:column>
<p:column headerText="Manufacturer">
<h:outputText value="#{cat.description}" />
</p:column>
<p:column headerText="Transaction">
<p:commandButton icon="ui-icon-search" value="Page"
action="#{Categories.getRetURL(cat)}">
</p:commandButton>
<p:commandButton icon="ui-icon-arrowrefresh-1-w" value="Edit">
</p:commandButton>
<p:commandButton icon="ui-icon-close" value="Delete"
onclick="deleteCdlg.show()" action="#{Categories.setSelectedCate(cat)}" update="@parent" >
<f:setPropertyActionListener value="#{cat}" target="#{Categories.selectedCat}" />
</p:commandButton>
</p:column>
</p:dataTable>
<div style="text-align: right; padding-top: 10px;">
<p:commandButton value="Add Category" icon="ui-icon-search"
onclick="addCdlg.show()" />
</div>
</h:form>
</p:panel>
<p:outputPanel id="deleteCatOut">
<p:dialog id="deleteCatdlg" header="Delete Category" modal="true"
align="center" widgetVar="deleteCdlg" showEffect="explode"
hideEffect="puff" dynamic="true"
rendered="#{userLogin.isAdmin()== true}">
<p:outputPanel id="deleteCatinOut">
<h:form>
<div style="padding-bottom: 10px;">
<h:outputLabel value="Are you sure to delete this">
</h:outputLabel>
<h:outputLabel value="#{Categories.selectedCat.name()}">
</h:outputLabel>
<h:outputLabel value=" category ?">
</h:outputLabel>
</div>
<p:commandButton value="Cancel" image="ui-icon-arrowrefresh-1-w"
type="reset" />
<p:commandButton actionListener="#{Categories.show()}" value="Delete" image="ui-icon-close" type="reset" />
</h:form>
</p:outputPanel>
</p:dialog>
</p:outputPanel>
That is the codes.
I want this.
When I clik
this button
from table.
<p:commandButton icon="ui-icon-close" value="Delete"
onclick="deleteCdlg.show()" action="#{Categories.setSe lectedCate (cat)}" update="@parent" >
<f:setPropertyActionListener value="#{cat}" target="#{Categories.selec tedCat}" />
</p:commandButton>
The dialog show selectes row information.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
How can I get id at <p:dialog id="deleteCatdlg"....
for example how can i show id in label.
<h:outputLabel value="#{Categories.select edCat.name ()}">
</h:outputLabel>
?
for example how can i show id in label.
<h:outputLabel value="#{Categories.select
</h:outputLabel>
?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I can set Value to bean.
<p:commandButton icon="ui-icon-close" value="Delete"
oncomplete="deleteCdlg.sho w()" update="deleteCatinOut">
<f:setPropertyActionListen er value="#{cat}"
target="#{Categories.selec tedCat}" />
</p:commandButton>
but I can not show selected value in opened dialog.
<p:outputPanel id="deleteCatOut">
<p:dialog id="deleteCatdlg" header="Delete Category" modal="true"
align="center" widgetVar="deleteCdlg" showEffect="explode"
hideEffect="puff" dynamic="true"
rendered="#{userLogin.isAd min()== true}">
<p:outputPanel id="deleteCatinOut">
<h:form>
<div style="padding-bottom: 10px;">
<h:outputLabel value="Are you sure to delete this">
</h:outputLabel>
<h:outputLabel value="#{Categories.select edCat.name }">
</h:outputLabel>
<h:outputLabel value=" category ?">
</h:outputLabel>
</div>
<p:commandButton value="Cancel" image="ui-icon-arrowrefres h-1-w"
type="reset" />
<p:commandButton actionListener="#{Categori es.show()} "
value="Delete" image="ui-icon-close" type="reset" />
</h:form>
</p:outputPanel>
</p:dialog>
</p:outputPanel>
----
This actions will be in same page without refreshing page.
<p:commandButton icon="ui-icon-close" value="Delete"
oncomplete="deleteCdlg.sho
<f:setPropertyActionListen
target="#{Categories.selec
</p:commandButton>
but I can not show selected value in opened dialog.
<p:outputPanel id="deleteCatOut">
<p:dialog id="deleteCatdlg" header="Delete Category" modal="true"
align="center" widgetVar="deleteCdlg" showEffect="explode"
hideEffect="puff" dynamic="true"
rendered="#{userLogin.isAd
<p:outputPanel id="deleteCatinOut">
<h:form>
<div style="padding-bottom: 10px;">
<h:outputLabel value="Are you sure to delete this">
</h:outputLabel>
<h:outputLabel value="#{Categories.select
</h:outputLabel>
<h:outputLabel value=" category ?">
</h:outputLabel>
</div>
<p:commandButton value="Cancel" image="ui-icon-arrowrefres
type="reset" />
<p:commandButton actionListener="#{Categori
value="Delete" image="ui-icon-close" type="reset" />
</h:form>
</p:outputPanel>
</p:dialog>
</p:outputPanel>
----
This actions will be in same page without refreshing page.
ASKER
Thanks