Checkbox is shown twice on select one radio button primefaces - jsf

I have selectOneRadio component in form with wizard and I have checkbox which should be enabled if first radio button is select. Here is my code for radio button:
<p:selectOneRadio id="decision" value="#{bean.decisionApproved}">
<f:selectItem itemLabel="Approved" itemValue="true" />
<f:selectItem itemLabel="Declined" itemValue="false"/>
<p:ajax update="permitPriniting"/>
</p:selectOneRadio>
Here is my code for checkbox:
<h:panelGroup id="permitPriniting">
<p:column colspan="2">
<p:selectBooleanCheckbox value="#{bean.printingApproved}"
id="printingApId"
disabled="#{bean.decisionApproved ne true}">
However when I select first radio button , the checkbox is not enabled and it is shown twice, like it is rendered again.

I just changed this:
<p:ajax update="permitPriniting"/>
to this:
<p:ajax update="printingApId"/>
And it works:)

Related

How enable/disable <p:tab> without update form?

I have a big <h:form>, with a <p:tabView> with 3 <p:tab>
I want to enable/disable one <p:tab> based on <p:selectOneRadio> click.
How can I achieve this without updating the entire form?
<p:selectOneRadio id = "pessoa" required = "true"
value="#{myBean.typeChecked}" valueChangeListener="#{myBean.checkTypeSelec}">
<f:selectItem itemLabel="item 1" itemValue="PF" />
<f:selectItem itemLabel="item 2" itemValue="PJ" />
<p:ajax event="click" update="???" execute="#this"/>
</p:selectOneRadio>
<p:tab title="History" id="historyTab" disabled="#{myBean.historyDisabled}">...
I dont wanna update entire form because I dont wanna loose other inputs data

scroll- or overflow-problem with p:selectOneMenu inside dialog

I am using Primefaces 6.2. When placing a selectbox inside a dialog and open it, it will scroll along the main page.
To avoid that, i've added appendTo="#(this)". With this change the scrolling works correctly, but if the height of the dropdown overflows the dialog height, automatically scrollbards are created for the dropdown and the dialog.
Example:
<p:dialog widgetVar="eventDialog" >
<p:selectOneMenu id="dummy" value="Selection" appendTo="#(this)">
<f:selectItems value="selection 1" />
<f:selectItems value="selection 2" />
</p:selectOneMenu>
</p>
To avoid the scrollbars and let the dropdown overflow i've tried panelStyle="position:fixed" instead of appendTo="#(this)". With this solution i have the problem, that the dropdown is not visible if i have a big page and scrolld down to the bottom, open the dialog and click on the dropdown.
Example:
<p:dialog widgetVar="eventDialog" >
<p:selectOneMenu id="dummy" value="Selection" panelStyle="position:fixed">
<f:selectItems value="selection 1" />
<f:selectItems value="selection 2" />
</p:selectOneMenu>
</p>
By the way i found the two solutions in the post "p:selectOneMenu dropdown part scrolls and does not stay in position".

Radio button not passing value when submitted

I have an UI where I use a radio button to select the gender. However, when I press submit to store the data to the database I only ever get a null value
This is the code:
<p:selectOneRadio id="gender"
value="{formBean.number}"
layout="grid"
columns="2"
required = "True"
requiredMessage="#{bundle.requiredGender}">
<f:selectItem itemLabel="#{bundle.labelMale}" itemValue="Male"/>
<f:selectItem itemLabel="#{bundle.labelFemale}" itemValue="Female" />
</p:selectOneRadio>
What have I missed out?

How to remove borders in primefaces datatable column of radio butto?

I have written a code to generate a datatable. The datatable column contains a radio button field. All is fine with the data table, but there comes a border in the radio button field.
the code snippet is as follows:
<p:column id="statuscolumn" headerText="#{prop['tum.userdatatable.status']}" filterBy="#{user.activeStatus}"
filterOptions="#{userListController.statusOptions}" sortBy="#{user.activeStatus}" style="border-style: none !important;">
<p:selectOneRadio value="#{user.activeStatus}">
<f:selectItem itemLabel="Active" itemValue="true"/>
<f:selectItem itemLabel="Inactive" itemValue="false"/>
<p:ajax listener="#{userListController.changeStatus}"/>
<f:attribute name="user" value="#{user}"/>
</p:selectOneRadio>
</p:column>
How to remove the borders arround the radio button field in the data table column field.
Please Help!
Thanks for help in advance.

SelectOneMenu with Delete link

I am wondering is there a way i can add delete() in the select one menu, so that the user either can select one from the menu or delete the record right from there itself. So far i have normal select one menu, i have a method called "#{statusReport.deleteTieckt}" method. I just wondering how to add that to the below select one menu.
<ice:selectOneMenu value="#{statusReport.projectDetID}"
style="width: 350px;" partialSubmit="true"
onchange="this.form.submit()" immediate="true"
valueChangeListener="#{statusReport.retrieveReport}">
<f:ajax disabled="true"></f:ajax>
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{statusReport.listOfProjectDetail}"
var="projectBO"
itemLabel="#{projectBO.projectDtObj.pname} #{projectBO.startDate} - #{projectBO.endDate}"
itemValue="#{projectBO.pdetailId}" noSelectionValue="true" />
</ice:selectOneMenu>

Resources