every button click display panelGroup component(it contains 3 components) - jsf-2

every button click display panelGroup component(it contains 3 components).how to do it using jsf or richfaces
<h:form id="autoId">
<h:panelGroup id="pg1" columns="3" >
<rich:autocomplete mode="client" minChars="1" autofill="false"
selectFirst="false"
autocompleteMethod="#{autocompleteBean.autocomplete}"
autocompleteList="#{autocompleteBean.suggestions}"
/>
<h:inputText value=""/>
<h:inputText value=""/>
</h:panelGroup>
<a4j:commandButton value="show pg" />
</h:form>
when clicking on commanButton i like to show panelGroup
how to do it

Related

f:param works only first time when using the same name in multiple commandButtons

My requierement is to upload some data and generate different reports for download with one click. In the example below I show appropriate button witch has a parameter that is sent to the download bean to select the correct version of the report.
But the f:param is only set the first time a p:commandButton is executed and then stays the same also for other buttons. Why is that and how can I solve this issue?
<h:form id="mainForm" enctype="multipart/form-data">
<p:fileUpload ...../>
....
....
<p:selectBooleanCheckbox id="opt1"
<p:ajax event="change" update="hiddingPanel"/>
</p:selectBooleanCheckbox>
<p:selectBooleanCheckbox id="opt2"
<p:ajax event="change" update="hiddingPanel"/>
</p:selectBooleanCheckbox>
<h:panelGroup id="hiddingPanel">
<p:commandButton id="doOpt1" rendered="#{bean.opt1 and !bean.opt2}"
actionListener="#{bean.readFile}" ajax="false" />
<p:fileDownload value="#{downloadBean.content}" />
<f:param name="reportType" value="REPORT1"/>
</p:commandButton>
<p:commandButton id="doOpt1" rendered="#{!bean.opt1 and bean.opt2}"
actionListener="#{bean.readFile}" ajax="false" />
<p:fileDownload value="#{downloadBean.content}" />
<f:param name="reportType" value="REPORT2"/>
</p:commandButton>
</h:panelGroup>
</h:form>
Thanks for any suggestions!
Regards.

a4j:ajax nested on h:inputText prevents execution of h:commandButton action on first click

I have the following code:
...
<h:inputText
id="valorMoedaLocal"
value="#{pagamentoRegistrarMB.valorMoedaLocal}"
styleClass="right dinheiro"
size="12"
maxlength="12">
<f:convertNumber
type="number"
minFractionDigits="2"
maxFractionDigits="2" />
<a4j:ajax
event="change"
execute="valorMoedaLocal"
render="valorPagamento"
listener="#{pagamentoRegistrarMB.calculaValorRealOuroCorrecao}" />
</h:inputText>
<h:outputText
id="valorPagamento"
value="#{pagamentoRegistrarMB.valorPagamento}"
maxlength="12">
<f:convertNumber
type="number"
minFractionDigits="2"
maxFractionDigits="2" />
</h:outputText>
...
<h:commandButton
id="cbCorrigir"
value="#{messages['label.corrigir.pagto']}"
action="#{pagamentoRegistrarMB.validarCorrecao}"
disabled="#{empty pagamentoRegistrarMB.idRequerimentoMovimentoCorrigir}">
<f:param
name="id"
value="#{pagamentoRegistrarMB.bean.id}" />
</h:commandButton>
If I change the content of field valorMoedaLocal and then I click on button cbCorrigir, the ajax nested on the inputText is executed and the action from button cbCorrigir is not executed; it requires a second click to execute.
This happens because when I click on the button, the inputText looses focus and this caauses its ajax to be executed, preventing following executions. Is there a way to avoid this undesired behavior?

rich:pickList Add/Remove Button not rendering a4j:outputpanel on first click

I am using richfaces 4.1 rich:picklist and need to render a4j:outputpanel on addition or removal of items in targetList. It renders outputpanel immediately on selecting Source/Target List elements but if directly click AddAll or RemoveAll button, output panel is not rendered on first click but renders onsecond click anywhere inside or outside screen.
Here is my code:
<rich:pickList value="#{myBean.selectedRegions}"
valueChangeListener="#{myBean.regionChangeListener}"
switchByClick="true" immediate="true">
<a4j:ajax event="additems" execute="#this" render="countryPanel" />
<a4j:ajax event="removeitems" execute="#this" render="countryPanel" />
<a4j:ajax event="sourceblur" execute="#this" render="countryPanel"/>
<a4j:ajax event="targetblur" execute="#this" render="countryPanel"/>
<a4j:ajax event="change" execute="#this" render="countryPanel" />
<f:selectItems value="#{myBean.regions}" var="region"
itemValue="#{region}" itemLabel="#{region.regionDesc}" />
<f:converter converterId="RegionConverter" />
</rich:pickList>
<a4j:outputPanel id="countryPanel" >
Upgrading to the latest RichFaces version should help. Also it would allow to simplify the code, you would need to specify only change event handler as the following issue has been fixed: https://issues.jboss.org/browse/RF-12360

Opening one <p:confirmDialog> from another <p:confirmDialog> in JSF

I have a JSF page in which I have two dialogs. I want to open one dialog on closing the other.I am using Primefaces 4.0.
Here is my JSF page.
<h:form>
<h:commandLink value="Click me" onclick="bezoekConfirmation.show();return false;"/>
<p:confirmDialog
message="Bent u zeker dat u dit bezoek wilt verwijderen?"
closable="false" header="Bezoek verwijderen" severity="alert"
widgetVar="bezoekConfirmation">
<p:commandButton value="Yes" oncomplete="bezoekConfirmation.hide()"
onclick="dialog.show();" ajax="false" />
<p:commandButton value="No" onclick="bezoekConfirmation.hide()"
type="button" />
</p:confirmDialog>
<p:confirmDialog message="Hai" closable="false"
header="Bezoek verwijderen" severity="alert" widgetVar="dialog">
<p:commandButton value="Yes" oncomplete="dialog.hide()"
action="#{controller.method()}" ajax="false" />
<p:commandButton value="No" onclick="dialog.hide()" type="button" />
</p:confirmDialog>
</h:form>
The first dialog appears. But on clicking the yes button of the first dialog, the second dialog never appears.
However the logic requires both the dialogs to appear one after the other.
Am I missing something?
Remove ajax="false" from the command Button and it will works

"prime faces undefined, Object expected : when accordion panel has data table command buttons and confirm dailogues insides each tab

Message: 'PrimeFaces' is undefined,
Message: Object expected:
This error appears on IE8 especially when there is Accordion panel.After refreshing the page there is no error. Accordion panel basically does not work on IE on initial load when accordion panel has data table command buttons and confirm dailogues insides each tab.Can any body have a work around on this. I am using using prime faces 3.4, jsf2 with myfaces
<p:accordionPanel value="#{testBean.systems}" var="system" dynamic="true">
<p:tab title="#{system.name}" id="systemId">
<p:commandButton process="#this" value="edit" icon="ui-icon-pencil" styleClass="btn-primary" style="margin-left:734px;" action="#{testBean.edit}">
<f:setPropertyActionListener target="#{testBean.formBean}" value="#{system}"></f:setPropertyActionListener>
</p:commandButton>
<p:commandButton value="delete" icon="ui-icon-trash" styleClass="btn-primary" style="width:70px;" oncomplete="confirmDeleteDialog.show()"/>
<p:confirmDialog message="message" width="200"
showEffect="explode" hideEffect="explode"
header="Confirm" severity="alert" widgetVar="confirmDeleteDialog">
<p:commandButton process="#this" value="#{msg.EditSystem_confirmAnswer1}" action="#{testBean.deleteSystem}" oncomplete="confirmDeleteDialog.hide()">
<f:setPropertyActionListener target="#{testBean.formBean}" value="#{system}"></f:setPropertyActionListener>
</p:commandButton>
<p:commandButton value="#{msg.EditSystem_confirmAnswer2}" onclick="confirmDeleteDialog.hide()" type="button" />
</p:confirmDialog>
<p:dataTable id="dataTable" var="tester" value="#{system.studs}" rowKey="#{tester.id}">
<p:column id="serName" sortBy="#{tester.name}" headerText="#{msg.AddService_serName}">
<p:commandLink value="#{tester.name}" immediate="true" process="#this" action="#{testBean1.edit}">
<f:setPropertyActionListener target="#{testBean1.testId}" value="#{tester.id}"/>
<f:setPropertyActionListener target="#{testBean1.testId2}" value="#{tester.desc}"/>
<f:setPropertyActionListener target="#{testBean1.testId3}" value="#{tester.name}"/>
</p:commandLink>
</p:column>

Resources