I am having trouble updating components in primefaces. Here is one example:
<h:form>
<p:panel style="width: 350px;" header="Partial Process">
<p:dataTable id="tablaPersonas" var="per" value="#{manejador.lista}">
<p:column style="text-align: center;">
<f:facet name="header">
<h:outputText value="Nombre" />
</f:facet>
<h:outputText value="#{per.nombre}" />
</p:column>
<p:column style="text-align: center;">
<f:facet name="header">
<h:outputText value="Apellido" />
</f:facet>
<h:outputText value="#{per.apellido}" />
</p:column>
<p:column headerText="Editar" style="text-align: center;">
<p:commandButton value="Editar"/>
</p:column>
</p:dataTable>
</p:panel>
<p:commandButton value="Abrir" onclick="widgetDlgAgregar.show();"/>
<p:dialog header="Agregar" widgetVar="widgetDlgAgregar" width="250" height="150" closable="true">
<h:panelGrid id="gridAdd" columns="2">
<h:outputLabel value="Nombre:"/>
<p:inputText value="#{manejador.auxiliarAgregar.nombre}"/>
<h:outputLabel value="Apellido:"/>
<p:inputText value="#{manejador.auxiliarAgregar.apellido}"/>
<p:commandButton oncomplete="widgetDlgAgregar.hide();" update="tablaPersonas,gridAdd" value="Agregar" actionListener="#{manejador.agregarPersona}"/>
</h:panelGrid>
</p:dialog>
</h:form>
As you see, I click on a CommandButton called "Abrir" and a Dialog opens with "Agregar" as title. I fill in the input boxes and when I click the CommandButton "Agregar", the DataTable isn't updated. Why is this happening?
Oh sorry i think you forgot this update
try this it should work
<h:form prependId="false">
<p:panel style="width: 350px;" header="Partial Process">
<p:dataTable id="tablaPersonas" var="per"
value="#{manejador.lista}">
<p:column style="text-align: center;">
<f:facet name="header">
<h:outputText value="Nombre" />
</f:facet>
<h:outputText value="#{per.nombre}" />
</p:column>
<p:column style="text-align: center;">
<f:facet name="header">
<h:outputText value="Apellido" />
</f:facet>
<h:outputText value="#{per.apellido}" />
</p:column>
<p:column headerText="Editar" style="text-align: center;">
<p:commandButton value="Editar" />
</p:column>
</p:dataTable>
</p:panel>
<p:commandButton value="Abrir" onclick="widgetDlgAgregar.show();" update="gridAdd" />
<p:dialog header="Agregar" widgetVar="widgetDlgAgregar" width="250"
height="150" closable="true">
<h:panelGrid id="gridAdd" columns="2">
<h:outputLabel value="Nombre:" />
<p:inputText value="#{manejador.auxiliarAgregar.nombre}" />
<h:outputLabel value="Apellido:" />
<p:inputText value="#{manejador.auxiliarAgregar.apellido}" />
<p:commandButton oncomplete="widgetDlgAgregar.hide();"
update="tablaPersonas,gridAdd" value="Agregar"
actionListener="#{manejador.agregarPersona}" />
</h:panelGrid>
</p:dialog>
</h:form>
try to put your
<p:dialog header="Agregar" widgetVar="widgetDlgAgregar" width="250" height="150" closable="true">
outside the form and add prependId="false" to your form <h:form prependId="false" >
Related
In dataList i'm displaying records and given edit and delete option,
While deleting i need to check my requirement depending on that i need to delete record,
But after delete DataList is not updating.
Could you please solve my problem...
<?xml version="1.0" encoding="UTF-8"?>
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<ui:composition template="PageTemplate.html">
<ui:define name="content">
<h:form id="form"
style="width: 70% !important; margin: 100px 0px 0px 205px;">
<!-- <p:growl id="growl" showDetail="true" autoUpdate="true" sticky="false"/> -->
<!-- <p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" /> -->
<p:tabView id="TabView" style="height:450px;"
activeIndex="#{appraisalComponent.tabindex}">
<p:ajax event="tabChange"
listener="#{appraisalComponent.getSectionAllList}" update="#form" />
<p:tab id="tab1" title="Create Section">
<p:outputPanel id="createSectionIds">
<p:dataTable id="sectionList" paginator="true" rows="5"
value="#{appraisalComponent.sectionListEdit}" var="sections"
editable="true">
<p:ajax event="rowEdit"
listener="#{appraisalComponent.updateSection(sections)}"
update=":form:TabView:sectionList" />
<p:ajax event="rowEditCancel" update=":form:TabView:sectionList" />
<p:column>
<f:facet name="header">
<h:outputText value="Section Name" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{sections.secName}" />
</f:facet>
<f:facet name="input">
<h:inputText value="#{sections.secName}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Operation" />
</f:facet>
<p:rowEditor />
<p:spacer width="20" height="0" />
<p:commandButton includeViewParams="true"
style="margin:-18px 0px 0px 20px;" title="Remove"
update=":form:TabView:createSectionIds"
process=":form:TabView:createSectionIds" icon="ui-icon-trash"
oncomplete="${appraisalComponent.sectionHaveQS(sections)} ? PF('confirmDialogDelete').show() : PF('confirmDialog').show()">
<f:setPropertyActionListener value="#{sections}"
target="#{appraisalComponent.selectedSec}" />
</p:commandButton>
<p:dialog header="Delete confirmation" appendToBody="true"
widgetVar="confirmDialogDelete" resizable="false" id="secDlg"
showEffect="fade" hideEffect="explode" modal="true">
Are you sure, you want to delete Employee:<h:outputText
value="#{appraisalComponent.selectedSec.secName}" />
<br></br>
<p:commandButton value="Yes Sure"
onclick="confirmDialogDelete.hide()"
action="#{appraisalComponent.deleteSection(appraisalComponent.selectedSec)}"
update=":form:TabView:createSectionIds"
process=":form:TabView:createSectionIds"
style=" margin-left: 34px;">
<p:collector value="#{appraisalComponent.selectedSec}"
removeFrom="#{appraisalComponent.sectionListEdit}" />
</p:commandButton>
<p:commandButton value="Not Yet"
onclick="confirmDialogDelete.hide()" type="button" />
</p:dialog>
<!-- <p:commandButton value="Remove" includeViewParams="true"
update=":form:TabView:createSectionIds"
process=":form:TabView:createSectionIds"
oncomplete="${appraisalComponent.sectionHaveQS(sections)} ? PF('confirmDialogDelete').show() : PF('confirmDialog').show()">
<f:setPropertyActionListener value="#{sections}"
target="#{appraisalComponent.selectedSec}" />
</p:commandButton>
<p:dialog header="Delete confirmation" appendTo="#(body)"
widgetVar="confirmDialogDelete" resizable="false"
showEffect="fade" hideEffect="explode" modal="true">
Are you sure, you want to delete Section:<h:outputText
value="#{appraisalComponent.selectedSec.secName}" />
<br></br>
<p:commandButton value="Yes Sure"
onclick="confirmDialogDelete.hide()"
action="#{appraisalComponent.deleteSection(appraisalComponent.selectedSec)}"
update=":form:TabView:createSectionIds"
process=":form:TabView:createSectionIds"
style=" margin-left: 34px;">
<p:collector value="#{appraisalComponent.selectedSec}"
removeFrom="#{appraisalComponent.sectionListEdit}" />
</p:commandButton>
<p:commandButton value="Not Yet"
onclick="confirmDialogDelete.hide()" />
</p:dialog>
-->
<p:dialog header="Delete confirmation" appendTo="#(body)"
widgetVar="confirmDialog" resizable="false" showEffect="fade"
hideEffect="explode" modal="true">
You need to delete questions which are belongs to this section...!<h:outputText
value="" />
<br></br>
<p:commandButton value="Ok" onclick="confirmDialog.hide()"
type="button" />
</p:dialog>
<!-- <p:commandButton value="Remove"
action="#{appraisalComponent.deleteSection(sections)}"
update=":form:TabView:createSectionIds"
process=":form:TabView:createSectionIds">
<p:collector value="#{sections}"
removeFrom="#{appraisalComponent.sectionListEdit}" />
</p:commandButton> -->
</p:column>
</p:dataTable>
</p:outputPanel>
</p:tab>
<p:tab id="tab2" title="Remarks List"
action="#{appraisalComponent.test}">
<p:outputPanel id="remarksIds">
<p:dataTable id="remarksList" paginator="true" rows="5"
value="#{appraisalComponent.remarksListEdit}" var="remarks"
editable="true">
<p:ajax event="rowEdit"
listener="#{appraisalComponent.updateRemarks(remarks)}"
update=":form:TabView:remarksList" />
<p:ajax event="rowEditCancel" update=":form:TabView:remarksList" />
<p:column>
<f:facet name="header">
<h:outputText value="Remarks Name" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{remarks.remName}" />
</f:facet>
<f:facet name="input">
<h:inputText value="#{remarks.remName}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Remarks Value" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{remarks.remValue}" />
</f:facet>
<f:facet name="input">
<h:inputText value="#{remarks.remValue}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Operation" />
</f:facet>
<p:rowEditor />
<p:commandButton value="Remove"
action="#{appraisalComponent.deleteRemarks(remarks)}"
update=":form:TabView:remarksIds"
process=":form:TabView:remarksIds">
<p:collector value="#{remarks}"
removeFrom="#{appraisalComponent.remarksListEdit}" />
</p:commandButton>
</p:column>
</p:dataTable>
</p:outputPanel>
</p:tab>
<p:tab id="tab3" title="Priority List">
<p:outputPanel id="priorityIds">
<p:dataTable id="priorityList" paginator="true" rows="5"
value="#{appraisalComponent.priorityListEdit}" var="priority"
editable="true">
<p:ajax event="rowEdit"
listener="#{appraisalComponent.updatePriority(priority)}"
update=":form:TabView:priorityList" />
<p:ajax event="rowEditCancel"
update=":form:TabView:priorityList" />
<p:column>
<f:facet name="header">
<h:outputText value="Priority Name" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{priority.prName}" />
</f:facet>
<f:facet name="input">
<h:inputText value="#{priority.prName}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Operation" />
</f:facet>
<p:rowEditor />
<p:commandButton value="Remove"
action="#{appraisalComponent.deletePriority(priority)}"
update=":form:TabView:priorityIds"
process=":form:TabView:priorityIds">
<p:collector value="#{priority}"
removeFrom="#{appraisalComponent.priorityListEdit}" />
</p:commandButton>
</p:column>
</p:dataTable>
</p:outputPanel>
</p:tab>
<p:tab id="tab4" title="List Of Section">
<p:dataTable id="dataTable" var="sections"
value="#{appraisalComponent.sectionListToAddQues}"
paginator="true" rows="5">
<p:column>
<f:facet name="header">
<h:outputText value="Section Name :" />
</f:facet>
<h:outputText value="#{sections.secName}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Operation" />
</f:facet>
<p:commandLink value="Edit Questions"
action="#{appraisalComponent.editQuestions}">
<f:param name="sectionId" value="#{sections.secId}" />
</p:commandLink>
</p:column>
</p:dataTable>
<br></br>
</p:tab>
</p:tabView>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
What ever i given in top that is correct, but problem with java method.
to delete, i given one java method " action="#{appraisalComponent.deleteSection(appraisalComponent.selectedSec)}" "
In java that is returning one value like below
public String deleteSection (int secId) {
String temp ;
// some code
return temp;
}
But we should provide only void method like below
public void deleteSection (int secId) {
}
I changed this now my code working fine.
Any way thanks. :)
My xhtml, If i put my CommandButton into the h:form the Actionlistener is not called:
<ui:composition template="/template.xhtml">
<style>
</style>
<ui:define name="title">
<h:outputText value="#{bundle.ListDashboardTitle}"></h:outputText>
</ui:define>
<ui:define name="body">
<h:form id="formDashboard">
<p:layout id="layoutVar" style="min-height:500px;">
<p:layoutUnit id="gridLeft" position="west" size="250" style="position:absolute;">
<p:fieldset style="padding:0;padding-top:5px">
<f:facet name="legend" id="legendId">
<p:commandButton id="addEvent" type="button" icon="ui-icon-plus" value="" onclick="addMemo.show()" update=":formAddMemo" style="width:30px;height:30px;"/>
</f:facet>
<p:dataGrid id="leftData" var="item" columns="1" value="#{myMemosController.items}" style="border:none;">
<p:panel id="pnl" styleClass="" style="background-color:#{item.priority}}" closable="true">
<!-- <p:ajax event="close" listener=""/>-->
<f:facet name="header">
<h:panelGroup>
<h:outputText value="#{item.name}" styleClass=""/>
<p:commandButton icon="ui-icon-pencil" actionListener="#{myMemosController.prepareEdit}" update=":editForm" onclick="editMemo.show();" style="width:19px;height:19px;"/>
</h:panelGroup>
</f:facet>
<f:facet name="footer">
<h:outputText value="#{item.date} at #{item.time}" styleClass="footerStyle"/>
</f:facet>
<h:panelGrid columns="1" style="width:100%">
<h:outputText value="#{item.comments}" styleClass=""/>
</h:panelGrid>
</p:panel>
<p:draggable for="pnl" helper="clone" handle=".ui-panel-titlebar" stack=".ui-panel" zindex="100"/>
</p:dataGrid>
</p:fieldset>
</p:layoutUnit>
<p:layoutUnit position="center" style="position:absolute;">
<p:outputPanel id="dropArea">
<p:dataTable id="centerGrid" value="#{dashboardController.items}" var="item">
<p:column style="text-align:center;">
<f:facet name="header">
<h:outputText value="Priority"/>
</f:facet>
<h:outputText value="#{item.priorityname}"/>
</p:column>
<p:column style="text-align:center;">
<f:facet name="header">
<h:outputText value="Name"/>
</f:facet>
<h:outputText value="#{item.name}"/>
</p:column>
<p:column style="text-align:center;">
<f:facet name="header">
<h:outputText value="Comment"/>
</f:facet>
<h:outputText value="#{item.comments}"/>
</p:column>
<p:column style="text-align:center;">
<f:facet name="header">
<h:outputText value="Time"/>
</f:facet>
<h:outputText value="#{item.time}"/>
</p:column>
<p:column style="text-align:center;">
<f:facet name="header">
<h:outputText value="Date"/>
</f:facet>
<h:outputText value="#{item.date}"/>
</p:column>
</p:dataTable>
</p:outputPanel>
<p:droppable id="droppablePanel" tolerance="touch" activeStyleClass="ui-state-highlight">
</p:droppable>
</p:layoutUnit>
<p:layoutUnit id="gridRight" position="east" size="250" style="position:absolute;">
<p:dataGrid id="rightGrid" var="item" columns="1" value="#{usersMemosController.items}">
<p:panel id="pnl" styleClass="" style="background-color:#{item.priority}}" closable="true">
<f:facet name="header">
<h:outputText value="#{item.name}" styleClass=""/>
</f:facet>
<f:facet name="footer">
<h:outputText value="#{item.date} at #{item.time}" styleClass="footerStyle"/>
</f:facet>
<h:panelGrid columns="1" style="width:100%">
<h:outputText value="#{item.comments}" styleClass=""/>
</h:panelGrid>
</p:panel>
<p:draggable for="pnl" helper="clone" handle=".ui-panel-titlebar" stack=".ui-panel" zindex="100"/>
</p:dataGrid>
</p:layoutUnit>
</p:layout>
</h:form>
<p:dialog id="dialogEditMemo" header="Edit Memo" widgetVar="editMemo" resizable="false" closable="true" closeOnEscape="true" draggable="false">
<h:form id="editForm">
<h:messages style="color:red;margin:8px;" />
<h:panelGrid columns="1" cellpadding="3">
<p:inputTextarea id="commentEditInput" value="#{myMemosController.currentComment}" rows="6" required="true">
<p:ajax event="keyup" />
<p:ajax event="change" />
</p:inputTextarea>
<p:watermark for="commentEditInput" value="Enter your memo..."/>
<h:panelGrid columns="2" cellpadding="1">
<h:outputLabel for="selectEditShare" value="Share Memo: " style="margin-right:40px;"/>
<p:selectBooleanCheckbox id="selectEditShare" label="selectEditShare"/>
</h:panelGrid>
<p:selectOneMenu id="chooseEditPriority" value="#{myMemosController.currentPriority}">
<f:selectItem itemLabel="Low Priority" itemValue="Low Priority" />
<f:selectItem itemLabel="Medium Priority" itemValue="Medium Priority" />
<f:selectItem itemLabel="High Priority" itemValue="High Priority" />
</p:selectOneMenu>
</h:panelGrid>
</h:form>
<p:panel id="panelEditBtn" style="border:none;">
<p:commandButton icon="ui-icon-close" value="Reset" type="reset"/>
<p:commandButton icon="ui-icon-check" actionListener="#{myMemosController.update}" value="Edit" process="#this" update=":formDashboard:leftData" onsuccess="editMemo.hide();"/>
</p:panel>
</p:dialog>
</ui:define>
</ui:composition>
When i want to display InputTextarea value is equal null:
public String update() {
System.out.println(getCurrentComment());
}
Thanks in advance
The problem is in your managedBean you have not instansiated the object currentComment .
And Please try to avoid nested form in your application.
I have gone with the same issue the issue is that sometime value is not set to the managedBean by ajax. So modify your <p:inputTextArea /> with the below code it works.
<p:inputTextarea id="commentEditInput"
value="#{myMemosController.currentComment}"rows="6" required="true">
<p:ajax event="keyup" />
<p:ajax event="change" />
</p:inputTextarea>
And For your actionListener just try to use process attribute that might work..
<p:commandButton id="submitEditDialog" icon="ui-icon-check"
actionListener="#{myMemosController.update}" value="Edit"
update=":formDashboard:leftData :editForm" onsuccess="editMemo.hide();"
process="#this"
/>
Ok, this issue is driving me nuts....
I've got this xhtml page, with 2 dialogs...
both dialogs has a form inside to send a submit to the server, they work fine, but when they are called and updated from a commandLink form, actionListener from dialog form just doesn't work, any ideas?
this is the menu where I call the dialogs
<ui:define name="left">
<h:form id="menuForm">
<div class="sidebar-nav">
<div class="well" style="width:150px; padding: 8px 0;">
<ul class="nav nav-list">
<li class="text-center">Options</li>
<li><p:commandLink id="createLink" update=":LocationCreateForm" actionListener="#{locationController.prepareCreate}" oncomplete="LocationCreateDialog.show()"><span class="glyphicon glyphicon-user"></span> Create New</p:commandLink> </li>
<li><p:commandLink id="editLink" update=":LocationEditForm" oncomplete="LocationEditDialog.show()"><span class="glyphicon glyphicon-edit"></span> Update</p:commandLink> </li>
<li><p:commandLink id="deleteLink" actionListener="#{locationController.delete}"><span class="glyphicon glyphicon-ban-circle"></span> Delete</p:commandLink> </li>
</ul>
</div>
</div>
</h:form>
</ui:define>
if I remove the update from commandLink they work, but for edit dialog I can't get the information to edit.
where the dialogs and list are:
<ui:define name="content">
<h1>Locations</h1>
<!-- Location List -->
<h:form id="LocationListForm">
<p:dataTable id="datalist" value="#{locationController.items}" var="item"
selectionMode="single" selection="#{locationController.selected}"
rowKey="#{item.id}"
>
<p:column sortBy="#{item.id}" filterBy="#{item.id}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_id}"/>
</f:facet>
<h:outputText value="#{item.id}"/>
</p:column>
<p:column sortBy="#{item.name}" filterBy="#{item.name}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_name}"/>
</f:facet>
<h:outputText value="#{item.name}"/>
</p:column>
<p:column sortBy="#{item.openingHourMonday}" filterBy="#{item.openingHourMonday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourMonday}"/>
</f:facet>
<h:outputText value="#{item.openingHourMonday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourTuesday}" filterBy="#{item.openingHourTuesday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourTuesday}"/>
</f:facet>
<h:outputText value="#{item.openingHourTuesday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourWednesday}" filterBy="#{item.openingHourWednesday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourWednesday}"/>
</f:facet>
<h:outputText value="#{item.openingHourWednesday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourThrusday}" filterBy="#{item.openingHourThrusday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourThrusday}"/>
</f:facet>
<h:outputText value="#{item.openingHourThrusday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourFriday}" filterBy="#{item.openingHourFriday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourFriday}"/>
</f:facet>
<h:outputText value="#{item.openingHourFriday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourSaturday}" filterBy="#{item.openingHourSaturday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourSaturday}"/>
</f:facet>
<h:outputText value="#{item.openingHourSaturday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourSunday}" filterBy="#{item.openingHourSunday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourSunday}"/>
</f:facet>
<h:outputText value="#{item.openingHourSunday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
</p:dataTable>
</h:form>
<!-- Location Create Dialog -->
<p:dialog id="LocationCreateDlg" widgetVar="LocationCreateDialog" modal="true" resizable="false" appendToBody="true" header="#{myBundle.CreateLocationTitle}">
<h:form id="LocationCreateForm">
<h:panelGroup id="display">
<p:panelGrid columns="2" >
<p:outputLabel value="#{myBundle.CreateLocationLabel_name}" for="name" />
<p:inputText id="name" value="#{locationController.selected.name}" title="#{myBundle.CreateLocationTitle_name}" required="true" requiredMessage="#{myBundle.CreateLocationRequiredMessage_name}"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourMonday}" for="openingHourMonday" />
<p:calendar id="openingHourMonday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourMonday}" title="#{myBundle.EditLocationTitle_openingHourMonday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourMonday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourTuesday}" for="openingHourTuesday" />
<p:calendar id="openingHourTuesday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourTuesday}" title="#{myBundle.EditLocationTitle_openingHourTuesday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourTuesday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourWednesday}" for="openingHourWednesday" />
<p:calendar id="openingHourWednesday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourWednesday}" title="#{myBundle.EditLocationTitle_openingHourWednesday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourWednesday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourThrusday}" for="openingHourThrusday" />
<p:calendar id="openingHourThrusday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourThrusday}" title="#{myBundle.EditLocationTitle_openingHourThrusday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourThrusday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourFriday}" for="openingHourFriday" />
<p:calendar id="openingHourFriday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourFriday}" title="#{myBundle.EditLocationTitle_openingHourFriday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourFriday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourSaturday}" for="openingHourSaturday" />
<p:calendar id="openingHourSaturday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourSaturday}" title="#{myBundle.EditLocationTitle_openingHourSaturday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourSaturday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourSunday}" for="openingHourSunday" />
<p:calendar id="openingHourSunday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourSunday}" title="#{myBundle.EditLocationTitle_openingHourSunday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourSunday}" showOn="button"/>
</p:panelGrid>
<p:commandButton actionListener="#{locationController.saveNew}" value="#{myBundle.Save}" update="display,:LocationListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,LocationCreateDialog);"/>
<p:commandButton value="#{myBundle.Cancel}" onclick="LocationCreateDialog.hide();"/>
</h:panelGroup>
</h:form>
</p:dialog>
<!-- Location Update Dialog -->
<p:dialog id="LocationEditDlg" widgetVar="LocationEditDialog" modal="true" resizable="false" appendToBody="true" header="#{myBundle.EditLocationTitle}">
<h:form id="LocationEditForm">
<h:panelGroup id="display">
<p:panelGrid columns="2" rendered="#{locationController.selected != null}">
<h:outputLabel value="#{myBundle.EditLocationLabel_id}" for="id" />
<h:outputText id="id" value="#{locationController.selected.id}" />
<p:outputLabel value="#{myBundle.EditLocationLabel_name}" for="name" />
<p:inputText id="name" value="#{locationController.selected.name}" title="#{myBundle.EditLocationTitle_name}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_name}"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourMonday}" for="openingHourMonday" />
<p:calendar id="openingHourMonday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourMonday}" title="#{myBundle.EditLocationTitle_openingHourMonday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourMonday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourTuesday}" for="openingHourTuesday" />
<p:calendar id="openingHourTuesday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourTuesday}" title="#{myBundle.EditLocationTitle_openingHourTuesday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourTuesday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourWednesday}" for="openingHourWednesday" />
<p:calendar id="openingHourWednesday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourWednesday}" title="#{myBundle.EditLocationTitle_openingHourWednesday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourWednesday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourThrusday}" for="openingHourThrusday" />
<p:calendar id="openingHourThrusday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourThrusday}" title="#{myBundle.EditLocationTitle_openingHourThrusday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourThrusday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourFriday}" for="openingHourFriday" />
<p:calendar id="openingHourFriday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourFriday}" title="#{myBundle.EditLocationTitle_openingHourFriday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourFriday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourSaturday}" for="openingHourSaturday" />
<p:calendar id="openingHourSaturday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourSaturday}" title="#{myBundle.EditLocationTitle_openingHourSaturday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourSaturday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourSunday}" for="openingHourSunday" />
<p:calendar id="openingHourSunday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourSunday}" title="#{myBundle.EditLocationTitle_openingHourSunday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourSunday}" showOn="button"/>
</p:panelGrid>
<p:commandButton actionListener="#{locationController.save}" value="#{myBundle.Save}" update="display,:LocationListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,LocationEditDialog);"/>
<p:commandButton value="#{myBundle.Cancel}" onclick="LocationEditDialog.hide();"/>
</h:panelGroup>
</h:form>
</p:dialog>
</ui:define>
Use process = "#this" in p:commandButton and appendTo="#(body)"in p:dialog
solved issue, updated to primefaces 4.0 RC1, changed appendToBody="true", to appendTo="#(body)"
Below is code of xhtml page,
even i put dialog in a form or not i can see outputtexts below of the page.
I am running into such situation for the first time.
<h:form id="form">
<h:outputLabel value="Welcome #{loginBean.name}"></h:outputLabel>
<p:dataTable id="cars" var="book" value="#{indexView.mediumBooksModel}" paginator="true" rows="10"
selection="#{indexView.selectedBook}" rowKey="">
<f:facet name="header">
RadioButton Based Selection
</f:facet>
<p:column selectionMode="single" style="width:2%" />
<p:column headerText="Title" style="width:25%">
#{book.title}
</p:column>
<p:column headerText="ISBN" style="width:25%">
#{book.isbn}
</p:column>
<p:column headerText="Year" style="width:24%">
#{book.year}
</p:column>
<p:column headerText="Price" style="width:24%">
#{book.price}
</p:column>
<f:facet name="footer">
<p:commandButton id="viewButton" value="View" icon="ui-icon-search"
update=":displaySingle" oncomplete="singleBookDialog.show()"/>
</f:facet>
</p:dataTable>
</h:form>
<p:dialog id="dialog" header="Book Detail" widgetVar="singleBookDialog" resizable="false"
modal="true" >
<h:panelGrid id="displaySingle" columns="2" cellpadding="4">
<f:facet name="header">
<p:graphicImage value="/images/books/#{indexView.selectedBook.image}.jpg"/>
</f:facet>
<h:outputText value="Title:" />
<h:outputText value="#{indexView.selectedBook.title}" style="font-weight:bold"/>
<h:outputText value="Year:" />
<h:outputText value="#{indexView.selectedBook.year}" style="font-weight:bold"/>
<h:outputText value="ISBN:" />
<h:outputText value="#{indexView.selectedBook.isbn}" style="font-weight:bold"/>
<h:outputText value="Price:" />
<h:outputText value="#{indexView.selectedBook.price}" style="font-weight:bold"/>
</h:panelGrid>
</p:dialog>
I have a parent form as and this form contain 5 more form on my five tabs. The problem is when i submit my parent form the data on parent form is submitting but all child form is not going on server. As i think by submitting parent form all child form are ignored. if i am right then please suggest a solution for this problem. i be very thankfull to all of you guys.I am using jsf2.0 primefaces 3.4
I have some problems in my page after merging the parent and children forms into a single one. I cannot update the <h:textarea> on row selection event.suggest me where i am wrong on update event my code is below
<h:form id="mainForm">
<h:panelGrid>
<p:accordionPanel activeIndex="#{salesLetterProBean.activeIndex}">
<p:tab title="Product Introduction" id="productinfooTab">
<p:panel header="Please Fill In The Details" style="padding:5px;"
id="productInfoPanel">
<h:panelGrid cellpadding="1" cellspacing="0" columns="1"
columnClasses="a,b,c,d,e" rowClasses="plainRow,shadedRow">
<h:outputLabel value="Introductory HeadLine:" class="field-title"
id="proInfoPanelGrid"/>
<p:inputTextarea value="#{salesLetterProBean.productIntroductoryLineRow.description}"
id="proIntroductorySentence"
style="width:1060px;height:400px;" effectDuration="400" />
</h:panelGrid>
<p:dataTable var="productIntroSentenceList" first="1"
value="#{salesLetterProBean.productIntroductorySentenceList}"
paginator="true" rows="5" rowsPerPageTemplate="5,10,15,20,25"
rowIndexVar="rowIndex" rowKey="#{productIntroSentenceList.id}"
selection="#{salesLetterProBean.productIntroductoryLineRow}"
selectionMode="single" update="proIntroductorySentence">
<p:ajax event="rowSelect" listener="#{salesLetterProBean.onRowSelect}" />
<p:column headerText="#">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{rowIndex}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{rowIndex}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Description">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{productIntroSentenceList.description}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{productIntroSentenceList.description}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Select">
<p:commandLink process="#none">
<!-- -->
<span title="Select" class="ui-icon ui-icon-check"/>
</p:commandLink>
</p:column>
</p:dataTable>
<h:panelGrid cellpadding="1" cellspacing="0" columns="1"
columnClasses="a,b,c,d,e" rowClasses="plainRow,shadedRow">
<h:outputLabel value="Feature List:" class="field-title" />
<p:inputTextarea style="width:1060px;height:400px;"
effectDuration="400" id="featureList"
value="#{salesLetterProBean.featureList}"/>
<h:outputLabel value="How Your Product Solve The Problems :"
class="field-title" />
<p:inputTextarea style="width:1060px;height:400px;"
effectDuration="400" id="prbSolutions"
value="#{salesLetterProBean.problemSolutions}" />
</h:panelGrid>
<h:commandButton value="Previous"
actionListener="#{applicantManagedBean.changeActiveIndex}"
immediate="true" class="defaultButton" />
<h:commandButton value=" Next "
actionListener="#{applicantManagedBean.changeActiveIndex}"
immediate="true" class="defaultButton" />
</p:panel>
</p:tab>
</p:accordionPanel>
</h:panelGrid>
</h:form>
Regards.
nested forms are not allowed, but you can have a multiple forms as stack.