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

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.

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

Checkbox is shown twice on select one radio button primefaces

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:)

Changing background color of input text after comparing if two Strings have different value

I have to radio buttons and text fields on the page. If the first radio button is clicked, the input text gets filled with the data. If the second radio button is clicked , then the same form gets updated and field with new information. In both cases I invoke two different functions for getting result. By default when I open the page, the first radio button is selected.
I have to color input text on the first radio button where the data in the first and second radio button are different. I have to compare if the value from for example (Name input text value from first radio button is equals to Name input text value from the second radio button). How to do that? I am new to PrimeFaces
<p:outputLabel for="name" value="#{msg['label.name']}" />
<p:inputText id="name" value="#{tab.radioButton=='First' ? tab.data.name1 : tab.data.name2}" disabled="true" />
You need ajax to update managed bean field when radio button is chosen, add conditional class to input field and refresh/update it.
XHTML
<h:form id="myForm">
<p:selectOneRadio value="#{tab.radioButton}">
<f:selectItem itemLabel="Choice 1" itemValue="First" />
<f:selectItem itemLabel="Choice 2" itemValue="Second" />
<p:ajax event="change" update=":myForm:name"/>
</p:selectOneRadio>
<p:outputLabel for="name" value="Name" />
<p:inputText id="name" value="#{tab.radioButton=='First' ? tab.data.name1 : tab.data.name2}" disabled="true"
styleClass="#{tab.radioButton == 'First' ? 'first-radio-checked' : 'other-radio-checked'}"/>
</h:form>
CSS
#myForm .first-radio-checked {
background-color: green;
}
#myForm .other-radio-checked {
background-color: red;
}

Rerender multiple h:panelGrid on change of h:selectOneMenu in JSF 1.2

The situation:
I want to display specific panelGrid(s) on the page based on drop-down selection. I am doing this by storing several boolean which get set to true/false based on which item is selected in the drop down. I use the onchange="submit()" to refresh/re-render the page.
The problem:
I have validation on many fields in the form, so if I select an item it does validation and will not display the form.
The question:
How do I get the selectOneMenu change to re-render only the set of controls on the page being impacted instead of the whole page and causing validation?
The code: (JSF 1.2)
<h:selectOneMenu id="list" value="#{sessionBean.myDecorator.selectedItem}"
onchange="submit()" immediate="true" required="true"
valueChangeListener="#{requestBean.listChanged}">
<f:selectItem itemValue="#{null}" itemLabel="--Select One--" noSelectionOption="true" />
<f:selectItems value="#{sessionBean.myDecorator.mapItems}" />
</h:selectOneMenu>
Field causing validation:
<h:inputTextarea id="lblRequiredField" cols="100" rows="3" required="true" immediate="true"
value="#{sessionBean.myDecorator.myDo.myField}">
<f:validateLength minimum="1" maximum="300" />
</h:inputTextarea>

Nesting a h:selectOneRadio inside another h:selectOneRadio 's f:selectitem

I want to create a group of radio buttons inside an option of another radio button.
It has to look like this.
Radio Title1
O Yes
Radio Title2
O Yes
O No
O No
When I try the following code the items are rendered as two rows of a table, but when i keep another component inside this selectone radio item, it keeps out of the table, So I am not able to achieve what I want.
<h:selectOneRadio id="reportDestination" layout="pageDirection">
<f:selectItem itemLabel="Yes" itemValue="Yes" />
<h:selectOneRadio layout="pageDirection">
<f:selectItems itemLabel="Yes" itemValue="Yes"/>
<f:selectItems itemLabel="No" itemValue="No"/>
</h:selectOneRadio >
<f:selectItem itemLabel="No" itemValue="No" />
</h:selectOneRadio>
Is there anyway to do it?
Any input is appreciated like a reference or a logic or anything.
Thanks in advance.

Resources