commandButton Richfaces doesn't work - spring

I am working with RicheFaces, when i click on commandButton "Add new User" i don't get the form to add new user.
Here is my code:
<ui:define name="title">
<h:outputText value="Users Management" />
</ui:define>
<!-- <h:outputText value="#{collaborateurBo.getAllCollaborateur().size()}" /> -->
<ui:define name="content">
<center>
<a4j:status onstart="#{rich:component('statPane')}.show()"
onstop="#{rich:component('statPane')}.hide()" />
<h:form id="form">
<a4j:outputPanel id="tableaa" layout="block">
<rich:dataTable value="#{PosteBean.getCollaborateurList()}" var="pr" iterationStatusVar="it" id="table"rows="15">
<rich:column>
<f:facet name="header">#</f:facet> #{it.index} </rich:column>
<rich:column>
<f:facet name="header">Last name</f:facet>
<h:outputText value="#{pr.getNom()}" />
</rich:column>
<rich:column>
<f:facet name="header">First name</f:facet>
<h:outputText value="#{pr.getPrenom()}" />
</rich:column>
<rich:column>
<a4j:commandLink styleClass="no-decor" execute="#this"render="#none"
oncomplete="#{rich:component('confirmPane')}.show()">
<h:graphicImage value="/css/images/delete.gif" alt="delete" />
<a4j:param value="#{it.index}"
assignTo="#{PosteBean.currentProjectIndex}" />
<f:setPropertyActionListener target="#{PosteBean.Collaborateurr}"value="#{p}" />
</a4j:commandLink>
<a4j:commandLink styleClass="no-decor" render="editGrid" execute="#this"
oncomplete="#{rich:component('editPane')}.show()">
<h:graphicImage value="/css/images/edit.gif" alt="edit" />
<a4j:param value="#{it.index}"
assignTo="#{PosteBean.currentProjectIndex}" />
<f:setPropertyActionListener target="#{PosteBean.Collaborateurr}" value="#{p}" />
</a4j:commandLink>
</rich:column>
<f:facet name="footer">
<rich:dataScroller id="scroller" />
</f:facet>
</rich:dataTable>
<a4j:commandButton styleClass="no-decor" render="addGrid"
oncomplete="#{rich:component('addPane1')}.show()"
value="Add new User">
</a4j:commandButton>
</a4j:outputPanel>
<a4j:jsFunction name="remove" action="Collaborateurr.remove()"
render="tableaa" execute="#this"
oncomplete="#{rich:component('confirmPane')}.hide();" />
<rich:popupPanel id="statPane" autosized="true">
<h:graphicImage value="/css/images/ai.gif" alt="ai" />
Please wait...
</rich:popupPanel>
<rich:popupPanel id="confirmPane" autosized="true">
Are you sure you want to delete the row?
<a4j:commandButton value="Cancel"
onclick="#{rich:component('confirmPane')}.hide(); return false;" />
<a4j:commandButton value="Delete" onclick="remove()" />
</rich:popupPanel>
<rich:popupPanel header="Edit User Details" id="editPane"
domElementAttachment="parent" width="400" height="200">
<rich:graphValidator id="gvv">
<rich:messages for="gvv" />
<rich:messages globalOnly="true" />
<!-- edit -->
<h:panelGrid columns="3" id="editGrid">
<h:outputText value="Last name" />
<h:inputText value="PosteBean.Collaborateurr" />
<h:panelGroup />
<h:outputText value="First name" />
<h:inputText value="" />
<h:panelGroup />
<h:outputText value="Email" />
<h:inputText value="" id="emaa" />
<rich:message for="emaa" />
</h:panelGrid>
<h:selectOneRadio id="koko" value="PosteBean.sflag">
<f:selectItem itemValue="ROLE_ADMIN" itemLabel="Manager" />
<f:selectItem itemValue="ROLE_USER" itemLabel="Tester" />
</h:selectOneRadio>
<a4j:commandButton value="Store" action="PosteBean.store"
render="table" execute="editPane"
oncomplete="if (#{facesContext.maximumSeverity==null}) {#{rich:component('editPane')}.hide();}" />
<a4j:commandButton value="Cancel"
onclick="#{rich:component('editPane')}.hide(); return false;" />
</rich:graphValidator>
</rich:popupPanel>
<rich:popupPanel header="Add User " id="addPane1"
domElementAttachment="parent" width="400" height="200">
<rich:graphValidator id="gv">
<rich:messages for="gv" />
<rich:messages globalOnly="true" />
<h:panelGrid columns="3" id="addGrid">
<h:outputText value="Last name" />
<h:inputText value="" />
<h:panelGroup />
<h:outputText value="First name" />
<!-- <h:inputText value="#{PosteBean.Collaborateurr}" /> -->
<h:panelGroup />
<h:outputText value="Email" />
<!-- <h:inputText value="#{PosteBean.Collaborateurr}" id="ema" /> -->
<rich:message for="ema" />
</h:panelGrid>
<h:selectOneRadio id="kokoo" value="#{PosteBean.sflag}">
<f:selectItem itemValue="ROLE_ADMIN" itemLabel="Manager" />
<f:selectItem itemValue="ROLE_USER" itemLabel="Tester" />
</h:selectOneRadio>
<a4j:commandButton value="Add" action="#{PosteBean.add}"
render="table" execute="addPane1"
oncomplete="if (#{facesContext.maximumSeverity==null}) {#{rich:component('addPane1')}.hide();}" />
<a4j:commandButton value="Cancel"
onclick="#{rich:component('addPane1')}.hide(); return false;" />
</rich:graphValidator>
</rich:popupPanel>
</h:form>
</center>
</ui:define>
</ui:composition>
Thanks in advance for helpping me, i want the button to give me the form,

1) rich:popupPanel should be moved outside of existing h:form;
2) inside each rich:popupPanel should be added h:form.
Reason: Popup panel always had requirement either
1) to be placed outside forms and have one inside
or
2) to have domElementAttachment attribute to set properly.

Related

My form inside a dialog keeps values when i re-open dialog

i am using a form inside a dialog to edit some data , i use setPropertyActionListener tag to get this data from a dataTable , my form shows correctly all fields , but when i change some data and close the dialog and reopen it (without submuting) the form keeps the latest data and ignore what is coming from setPropertyActionListener
here is my code used to open the dialog
<p:menuButton value="Actions">
<p:menuitem resetValues="true" value="Update"
icon="fa fa-edit" process="#this"
actionListener="#{myMB.resetSelectedEntite(a)}"
update="formUpdateAff:displayEditionAff"
oncomplete="PF('affUpdateDialogWidget').show()">
<f:setPropertyActionListener
target="#{myMB.selectedAffectation}" value="#{a}" />
<f:actionListener
type="com.dummy.AffActionListener" />
</p:menuitem>
code for dialog :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:body>
<p:dialog widgetVar="affUpdateDialogWidget" id="affEditerDialogId"
width="30%" showEffect="explode" hideEffect="explode" modal="true">
<h:form id="formUpdateAff" prependId="true">
<p:panel style="margin-bottom:20px;float:center"
widgetVar="titlePanelWidget" collapsed="true"
styleClass="customTitleBar">
<f:facet name="header">
Update
</f:facet>
</p:panel>
<p:tooltip position="top" />
<h:panelGrid id="displayEditionAff" columns="3" cellpadding="4">
<p:outputLabel value="" />
<h:inputHidden value="#{myMB.selectedAffectation.id}" id="idAff" />
<p:message for="idAff" display="tooltip" />
<p:outputLabel value="Date Aff :" for="dateAffectId" />
<p:calendar value="#{myMB.selectedAffectation.dateAff}"
id="dateAffectId" pattern="dd/MM/yyyy" yearRange="c-10:c+0"
showButtonPanel="true" converter="primefacesCalendarConverter"
required="true" locale="fr" showOn="button" />
<p:message for="dateAffectId" display="tooltip" />
<p:outputLabel value="Ville :" for="villeIdAff" />
<p:selectOneMenu style="width:100%; font-weight:bold"
required="true" id="villeIdAff" appendTo="#this"
value="#{myMB.selectedAffectation.refCompagnie.refGroupement.refVille.id}"
rendered="#{myMB.selectedAffectation.refCompagnie.id != 0}">
<f:selectItem itemLabel="----------------" itemValue="" />
<f:selectItems value="#{lieuUnitMB.selectLieuxByType('VILLE',0)}"
var="a" itemValue="#{a.id}" itemLabel="#{a.libelle}" />
<p:ajax
listener="#{myMB.loadGroupements(myMB.selectedAffectation.refCompagnie.refGroupement.refVille.id , myMB.selectedAffectation.refCompagnie.refGroupement.refCatGroupement.id)}"
update="groupIdAff groupIdxxx" />
</p:selectOneMenu>
<p:selectOneMenu style="width:100%; font-weight:bold"
rendered="#{myMB.selectedAffectation.refCompagnie.id == 0}"
required="true" id="villeId2" appendTo="#this"
value="#{myMB.selectedAffectation.refGroupement.refVille.id}">
<f:selectItem itemLabel="----------------" itemValue="" />
<f:selectItems value="#{lieuUnitMB.selectLieuxByType('VILLE',0)}"
var="a" itemValue="#{a.id}" itemLabel="#{a.libelle}" />
<p:ajax
listener="#{myMB.loadGroupements(myMB.selectedAffectation.refGroupement.refVille.id , myMB.selectedAffectation.refGroupement.refCatGroupement.id)}"
update="groupIdAff groupIdxxx" />
</p:selectOneMenu>
<p:message for="villeId2" display="tooltip" />
<p:outputLabel value="Catégorie Groupement :" for="catIdAff" />
<p:selectOneMenu style="width:100%; font-weight:bold"
required="true" id="catIdAff" appendTo="#this"
value="#{myMB.selectedAffectation.refGroupement.refCatGroupement.id}"
rendered="#{myMB.selectedAffectation.refCompagnie.id == 0}">
<f:selectItem itemLabel="----------------" itemValue="" />
<f:selectItems value="#{repositoryMB.selectRepositories()}" />
<p:ajax
listener="#{myMB.loadGroupements(myMB.selectedAffectation.refGroupement.refVille.id , myMB.selectedAffectation.refGroupement.refCatGroupement.id)}"
update="groupIdAff groupIdxxx" />
</p:selectOneMenu>
<p:selectOneMenu style="width:100%; font-weight:bold"
required="true" id="catId2" appendTo="#this"
value="#{myMB.selectedAffectation.refCompagnie.refGroupement.refCatGroupement.id}"
rendered="#{myMB.selectedAffectation.refCompagnie.id != 0}">
<f:selectItem itemLabel="----------------" itemValue="" />
<f:selectItems value="#{repositoryMB.selectRepositories()}" />
<p:ajax
listener="#{myMB.loadGroupements(myMB.selectedAffectation.refCompagnie.refGroupement.refVille.id , myMB.selectedAffectation.refCompagnie.refGroupement.refCatGroupement.id)}"
update="groupIdAff groupIdxxx" />
</p:selectOneMenu>
<p:message for="catIdAff" display="tooltip" />
<p:outputLabel value="Groupement :" for="groupIdAff" />
<p:selectOneMenu
value="#{myMB.selectedAffectation.refCompagnie.refGroupement.id}"
style="width:100%; font-weight:bold" required="true"
id="groupIdAff" appendTo="#this"
rendered="#{myMB.selectedAffectation.refCompagnie.id != 0}">
<f:selectItem itemLabel="----------------" itemValue="" />
<f:selectItems
value="#{myMB.loadGroupements(myMB.selectedAffectation.refCompagnie.refGroupement.refVille.id , myMB.selectedAffectation.refCompagnie.refGroupement.refCatGroupement.id)}" />
<p:ajax
listener="#{myMB.loadCompagniesUpdate(myMB.selectedAffectation.refGroupement.id)}"
update="displayEditionAff,toto" />
</p:selectOneMenu>
<p:selectOneMenu
value="#{myMB.selectedAffectation.refGroupement.id}"
style="width:100%; font-weight:bold" required="true"
id="groupIdxxx" appendTo="#this"
rendered="#{myMB.selectedAffectation.refCompagnie.id == 0}">
<f:selectItem itemLabel="----------------" itemValue="" />
<f:selectItems
value="#{myMB.loadGroupements(myMB.selectedAffectation.refGroupement.refVille.id , myMB.selectedAffectation.refGroupement.refCatGroupement.id)}" />
<p:ajax
listener="#{myMB.loadCompagniesUpdate(myMB.selectedAffectation.refGroupement.id)}"
update="displayEditionAff,toto" />
</p:selectOneMenu>
<p:message for="groupIdAff" display="tooltip" />
<p:outputLabel value="Compagnie :" for="toto"
binding="#{myMB.uiOutputLabel}"
rendered="#{not empty myMB.compagniesUpdate}" />
<p:selectOneMenu binding="#{myMB.uiOutput}"
rendered="#{not empty myMB.compagniesUpdate}"
value="#{myMB.selectedAffectation.refCompagnie.id}"
style="width:100%; font-weight:bold" required="false" id="toto"
appendTo="#this" immediate="true">
<f:selectItem itemLabel="----------------" itemValue="" />
<f:selectItems
value="#{myMB.loadCompagniesUpdate(myMB.selectedAffectation.refGroupement.id)}" />
</p:selectOneMenu>
<p:message for="toto" display="tooltip"
rendered="#{not empty myMB.compagniesUpdate}"
binding="#{myMB.uiOutputMsg}" />
</h:panelGrid>
<p:spacer />
<p:spacer />
<h:panelGrid columns="2">
<p:commandButton value="Editer" icon="ui-icon-plus"
action="#{myMB.updateEntite()}"
update=":entiteDetailDialogForm:tabsId:formAff:AffTable :messageGrowl :formUpdateAff"
process=":formUpdateAff"
oncomplete="closeDialogIfSucess(xhr, status, args, 'AffUpdateDialogWidget', 'AffEditerDialogId')" />
<p:commandButton value="#{bundle.cancel}" icon="ui-icon-cancel"
actionListener="#{myMB.resetSelectedEntite()}" type="button"
onclick="PF('AffUpdateDialogWidget').hide();" />
</h:panelGrid>
</h:form>
</p:dialog>
</h:body>
</html>
i am using Primefaces 6.1

How to enable my radiobutton with primefaces

enable/disable my selectOneRadio does not work like expected. It only activates after a "submit" and the ajax-direct approach does not work.
When I change the selection (click) to "Group", then the dropDown after the selection keeps being "disabled". It only appears after a "submit", but I like to have direct-ajax function.
<div>
<p:outputPanel id="customPanel" style="margin-bottom:10px">
<p:selectOneRadio id="locationType" value="#{bean.query.locationType}"
required="true" layout="custom">
<f:ajax render="locationGroup locationOrganization">
<f:selectItems value="#{bean.locationTypeSelectItems}"
var="locationTypeItem" itemValue="#{locationTypeItem}" itemLabel="#{msgs[locationTypeItem.label]}" />
</f:ajax>
</p:selectOneRadio>
<h:panelGrid columns="3" cellpadding="5">
<p:radioButton id="option1" for="locationType" itemIndex="0" />
<p:outputLabel for="locationGroup" value="Group"/>
<p:autoComplete id="locationGroup"
value="#{bean.query.locationGroup}"
completeMethod="#{bean.completeGroups}"
var="group"
itemLabel="#{group.description}"
itemValue="#{group}"
converter="org.company.project.presentation.group.GroupConverter"
maxResults="10"
dropdown="true"
cache="true"
disabled="#{bean.locationGroupDisabled}"/>
<p:radioButton id="option2" for="locationType" itemIndex="1" />
<p:outputLabel for="locationOrganization" value="#{msgs.pat_Organization}"/>
<p:autoComplete id="locationOrganization"
value="#{bean.query.locationOrganization}"
completeMethod="#{bean.completeOrganizations}"
var="organization"
itemLabel="#{organization.name}"
itemValue="#{organization}"
converter="org.company.project.presentation.organization.OrganizationConverter"
maxResults="10"
dropdown="true"
cache="true"
disabled="#{bean.locationOrganizationDisabled}"/>
<p:radioButton id="option3" for="locationType" itemIndex="2" />
<p:outputLabel value="All" />
</h:panelGrid>
<p:message for="locationGroup" />
<p:message for="locationOrganization" />
</p:outputPanel>
<p:message for="locationType" />
That's all folks!

popupPanel Richfaces doesn't work

I am working with RicheFaces, when i click to have popupPanel "Edit User Details" i don't get the form to Edit User Details.
Here is my code:
<ui:define name="title">
<h:outputText value="Users Management" />
</ui:define>
<!-- <h:outputText value="#{collaborateurBo.getAllCollaborateur().size()}" /> -->
<ui:define name="content">
<center>
<a4j:status onstart="#{rich:component('statPane')}.show()"
onstop="#{rich:component('statPane')}.hide()" />
<h:form id="form">
<a4j:outputPanel id="tableaa" layout="block">
<rich:dataTable value="#{PosteBean.getCollaborateurList()}" var="pr" iterationStatusVar="it" id="table"rows="15">
<rich:column>
<f:facet name="header">#</f:facet> #{it.index} </rich:column>
<rich:column>
<f:facet name="header">Last name</f:facet>
<h:outputText value="#{pr.getNom()}" />
</rich:column>
<rich:column>
<f:facet name="header">First name</f:facet>
<h:outputText value="#{pr.getPrenom()}" />
</rich:column>
<rich:column>
<a4j:commandLink styleClass="no-decor" execute="#this"render="#none"
oncomplete="#{rich:component('confirmPane')}.show()">
<h:graphicImage value="/css/images/delete.gif" alt="delete" />
<a4j:param value="#{it.index}"
assignTo="#{PosteBean.currentProjectIndex}" />
<f:setPropertyActionListener target="#{PosteBean.Collaborateurr}"value="#{p}" />
</a4j:commandLink>
<a4j:commandLink styleClass="no-decor" render="editGrid" execute="#this"
oncomplete="#{rich:component('editPane')}.show()">
<h:graphicImage value="/css/images/edit.gif" alt="edit" />
<a4j:param value="#{it.index}"
assignTo="#{PosteBean.currentProjectIndex}" />
<f:setPropertyActionListener target="#{PosteBean.Collaborateurr}" value="#{p}" />
</a4j:commandLink>
</rich:column>
<f:facet name="footer">
<rich:dataScroller id="scroller" />
</f:facet>
</rich:dataTable>
<a4j:commandButton styleClass="no-decor" render="addGrid"
oncomplete="#{rich:component('addPane1')}.show()"
value="Add new User">
</a4j:commandButton>
</a4j:outputPanel>
<a4j:jsFunction name="remove" action="Collaborateurr.remove()"
render="tableaa" execute="#this"
oncomplete="#{rich:component('confirmPane')}.hide();" />
<rich:popupPanel id="statPane" autosized="true">
<h:graphicImage value="/css/images/ai.gif" alt="ai" />
Please wait...
</rich:popupPanel>
<rich:popupPanel id="confirmPane" autosized="true">
Are you sure you want to delete the row?
<a4j:commandButton value="Cancel"
onclick="#{rich:component('confirmPane')}.hide(); return false;" />
<a4j:commandButton value="Delete" onclick="remove()" />
</rich:popupPanel>
<rich:popupPanel header="Edit User Details" id="editPane"
domElementAttachment="parent" width="400" height="200">
<rich:graphValidator id="gvv">
<rich:messages for="gvv" />
<rich:messages globalOnly="true" />
<!-- edit -->
<h:panelGrid columns="3" id="editGrid">
<h:outputText value="Last name" />
<h:inputText value="PosteBean.Collaborateurr" />
<h:panelGroup />
<h:outputText value="First name" />
<h:inputText value="" />
<h:panelGroup />
<h:outputText value="Email" />
<h:inputText value="" id="emaa" />
<rich:message for="emaa" />
</h:panelGrid>
<h:selectOneRadio id="koko" value="PosteBean.sflag">
<f:selectItem itemValue="ROLE_ADMIN" itemLabel="Manager" />
<f:selectItem itemValue="ROLE_USER" itemLabel="Tester" />
</h:selectOneRadio>
<a4j:commandButton value="Store" action="PosteBean.store"
render="table" execute="editPane"
oncomplete="if (#{facesContext.maximumSeverity==null}) {#{rich:component('editPane')}.hide();}" />
<a4j:commandButton value="Cancel"
onclick="#{rich:component('editPane')}.hide(); return false;" />
</rich:graphValidator>
</rich:popupPanel>
<rich:popupPanel header="Add User " id="addPane1"
domElementAttachment="parent" width="400" height="200">
<rich:graphValidator id="gv">
<rich:messages for="gv" />
<rich:messages globalOnly="true" />
<h:panelGrid columns="3" id="addGrid">
<h:outputText value="Last name" />
<h:inputText value="" />
<h:panelGroup />
<h:outputText value="First name" />
<!-- <h:inputText value="#{PosteBean.Collaborateurr}" /> -->
<h:panelGroup />
<h:outputText value="Email" />
<!-- <h:inputText value="#{PosteBean.Collaborateurr}" id="ema" /> -->
<rich:message for="ema" />
</h:panelGrid>
<h:selectOneRadio id="kokoo" value="#{PosteBean.sflag}">
<f:selectItem itemValue="ROLE_ADMIN" itemLabel="Manager" />
<f:selectItem itemValue="ROLE_USER" itemLabel="Tester" />
</h:selectOneRadio>
<a4j:commandButton value="Add" action="#{PosteBean.add}"
render="table" execute="addPane1"
oncomplete="if (#{facesContext.maximumSeverity==null}) {#{rich:component('addPane1')}.hide();}" />
<a4j:commandButton value="Cancel"
onclick="#{rich:component('addPane1')}.hide(); return false;" />
</rich:graphValidator>
</rich:popupPanel>
</h:form>
</center>
</ui:define>
</ui:composition>
Thanks in advance for helpping me, i wanna have the form of editing,
1) rich:popupPanel should be moved outside of existing h:form;
2) inside each rich:popupPanel should be added h:form.
Reason: Popup panel always had requirement either
to be placed outside forms and have one inside
or
to have domElementAttachment attribute to set properly.

How to fill popup panel with detailed information from datatable in RichFaces

I am working with RichFaces, and in an form for editing I can't get values of the element that I want to edit,
here is my code:
<!-- <h:outputText value="#{collaborateurBo.getAllCollaborateur().size()}" /> -->
<ui:define name="content">
<center>
<a4j:status onstart="#{rich:component('statPane')}.show()"
onstop="#{rich:component('statPane')}.hide()" />
<h:form id="form">
<a4j:outputPanel id="tableaa" layout="block">
<rich:dataTable value="#{PosteBean.getCollaborateurList()}" var="pr" iterationStatusVar="it" id="table"rows="15">
<rich:column>
<f:facet name="header">#</f:facet> #{it.index} </rich:column>
<rich:column>
<f:facet name="header">Last name</f:facet>
<h:outputText value="#{pr.getNom()}" />
</rich:column>
<rich:column>
<f:facet name="header">First name</f:facet>
<h:outputText value="#{pr.getPrenom()}" />
</rich:column>
<rich:column>
<a4j:commandLink styleClass="no-decor" execute="#this"render="#none"
oncomplete="#{rich:component('confirmPane')}.show()">
<h:graphicImage value="/css/images/delete.gif" alt="delete" />
<a4j:param value="#{it.index}"
assignTo="#{PosteBean.currentProjectIndex}" />
<f:setPropertyActionListener target="#{PosteBean.Collab}"value="#{p}" />
</a4j:commandLink>
<a4j:commandLink styleClass="no-decor" render="editGrid" execute="#this"
oncomplete="#{rich:component('editPane')}.show()">
<h:graphicImage value="/css/images/edit.gif" alt="edit" />
<a4j:param value="#{it.index}"
assignTo="#{PosteBean.currentProjectIndex}" />
<f:setPropertyActionListener target="#{PosteBean.Collab}" value="#{p}" />
</a4j:commandLink>
</rich:column>
<f:facet name="footer">
<rich:dataScroller id="scroller" />
</f:facet>
</rich:dataTable>
<a4j:commandButton styleClass="no-decor" render="addGrid"
oncomplete="#{rich:component('addPane1')}.show()"
value="Add new User">
</a4j:commandButton>
</a4j:outputPanel>
<a4j:jsFunction name="remove" action="Collaborateurr.remove()"
render="tableaa" execute="#this"
oncomplete="#{rich:component('confirmPane')}.hide();" />
<rich:popupPanel id="statPane" autosized="true">
<h:graphicImage value="/css/images/ai.gif" alt="ai" />
Please wait...
</rich:popupPanel>
<rich:popupPanel id="confirmPane" autosized="true">
Are you sure you want to delete the row?
<a4j:commandButton value="Cancel"
onclick="#{rich:component('confirmPane')}.hide(); return false;" />
<a4j:commandButton value="Delete" onclick="remove()" />
</rich:popupPanel>
</h:form>
<rich:popupPanel header="Edit User Details" id="editPane"
domElementAttachment="parent" width="400" height="200">
<h:form id="form2">
<rich:graphValidator id="gvv">
<rich:messages for="gvv" />
<rich:messages globalOnly="true" />
<h:panelGrid columns="3" id="editGrid">
<h:outputText value="nom" />
<h:inputText value="#{PosteBean.collab.nom}" />
<h:panelGroup />
<h:outputText value="prenom" />
<h:inputText value="#{PosteBean.collab.prenom}" />
</h:panelGrid>
<h:selectOneRadio id="koko" value="PosteBean.sflag">
<f:selectItem itemValue="ROLE_ADMIN" itemLabel="Manager" />
<f:selectItem itemValue="ROLE_USER" itemLabel="Tester" />
</h:selectOneRadio>
<a4j:commandButton value="Store" action="PosteBean.store"
render="table" execute="editPane"
oncomplete="if (#{facesContext.maximumSeverity==null}) {#{rich:component('editPane')}.hide();}" />
<a4j:commandButton value="Cancel"
onclick="#{rich:component('editPane')}.hide(); return false;" />
</rich:graphValidator>
</h:form>
</rich:popupPanel>
<rich:popupPanel header="Add User " id="addPane1"
domElementAttachment="parent" width="400" height="200">
<rich:graphValidator id="gv">
<rich:messages for="gv" />
<rich:messages globalOnly="true" />
<h:panelGrid columns="3" id="addGrid">
<h:outputText value="Last name" />
<h:inputText value="#{PosteBean.collab.nom}" />
<h:panelGroup />
<h:outputText value="First name" />
<h:inputText value="#{PosteBean.collab.prenom}" />
<h:panelGroup />
</h:panelGrid>
<h:selectOneRadio id="kokoo" value="#{PosteBean.sflag}">
<f:selectItem itemValue="ROLE_ADMIN" itemLabel="Manager" />
<f:selectItem itemValue="ROLE_USER" itemLabel="Tester" />
</h:selectOneRadio>
<a4j:commandButton value="Add" action="#{PosteBean.add}"
render="table" execute="addPane1"
oncomplete="if (#{facesContext.maximumSeverity==null}) {#{rich:component('addPane1')}.hide();}" />
<a4j:commandButton value="Cancel"
onclick="#{rich:component('addPane1')}.hide(); return false;" />
</rich:graphValidator>
</rich:popupPanel>
</center>
</ui:define>
</ui:composition>
Thanks in advance for helping me, i wanna have values and edit them in the form

JSF Primefaces form errors after failed validation

I am new to JSF/Java in general but have been trying to solve this for a few days now.
I have a form which gets stuck on validation. When all the entries are valid, it all works well. The minute I break validation (such as don't provide a required value), then the form gets stuck. One thing that happens is I cant correct the invalid entry it seems and repost. Also, where I had a cascading ajax call of a selectOneMenu, that suddenly starts failing...even though this is not the invalidated part of the form.
I notice that the cascading drop down seems to be throwing null pointer exceptions in its overridden equals method.
I am at a loss.
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition template="/templates/layout.xhtml">
<ui:define name="content">
<p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/>
<p:dialog modal="true" widgetVar="statusDialog" header="Status"
draggable="false" closable="false">
<p:graphicImage value="/resources/images/ajaxloadingbar.gif" />
</p:dialog>
<h:form id="form">
<p:panel id="panel"
header="Please ensure your personal details are accurate"
style="margin-bottom:10px;">
<p:messages id="msgs" />
<h:outputText
value="Please ensure your personal details are up to date and accurate within the Admin Direct system. Please note that this application only supports GMD customers, so unless you are within GMD, or are a user of the GMD Admin Direct service, please do not enter your details or attempt to use the application for administrative support." />
<h:panelGrid columns="3" cellpadding="5" id="grid">
<h:outputText value="First Name:" style="font-weight:bold" />
<p:inputText id="firstName"
value="#{personalDetailsBean.user.firstName}"
requiredMessage="First name is required..." style="width:250px" />
<p:message id="firstNameMessage" for="firstName" />
<h:outputText value="Last Name:" style="font-weight:bold" />
<p:inputText id="lastName"
value="#{personalDetailsBean.user.lastName}"
requiredMessage="Last name is required..." style="width:250px" />
<p:message id="lastNameMessage" for="lastName" />
<h:outputText value="Select Function:" style="font-weight:bold" />
<p:selectOneMenu id="functions"
value="#{personalDetailsBean.user.function}"
style="width:250px">
<f:selectItem itemLabel="Select Function" itemValue="" />
<f:selectItems value="#{personalDetailsBean.functions}" var="func"
itemLabel="#{func.functionName}" itemValue="#{func}" />
<f:converter converterId="functionConverter" />
</p:selectOneMenu>
<p:message id="functionMessage" for="functions" />
<h:outputText value="Select Site" style="font-weight:bold" />
<p:selectOneMenu id="sites"
value="#{personalDetailsBean.user.site}"
style="width:250px">
<f:selectItem itemLabel="Select Site" itemValue="" />
<f:selectItems value="#{personalDetailsBean.sites}" var="sit"
itemLabel="#{sit.siteName}" itemValue="#{sit}" />
<f:converter converterId="siteConverter" />
<p:ajax update="region" event="change" process="#this"/>
</p:selectOneMenu>
<p:message id="siteMessage" for="sites" />
<h:outputText value="Region" style="font-weight:bold" />
<h:outputText id="region"
value="#{personalDetailsBean.user.site.region.regionName}" />
<p:message id="regionMessage" for="region" />
<h:outputText value="Email" style="font-weight:bold" />
<p:inputText id="email" value="#{personalDetailsBean.user.email}"
required="true"
validatorMessage="Invalid email address format"
style="width:250px">
<f:validateRegex
pattern="[\w\.-]*[a-zA-Z0-9_]#[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
<f:validateLength minimum="2" />
</p:inputText>
<p:message id="emailMessage" for="email" />
</h:panelGrid>
<p:separator />
<p:commandButton value="Save" id="btnSubmit" actionListener="#{personalDetailsBean.saveUser}" process="#all" update="panel" />
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</html>
any advice greatly appreciated.
Regards
SM

Resources