I am using http://myfaces.apache.org/core20/index.html and http://myfaces.apache.org/tomahawk-project/tomahawk20/tagdoc/t_selectOneRadio.html.
I have used tomahawk <t:selectOneRadio> in my jsf page.
<t:selectOneRadio id="myScript" value="#{bean.myScript}" layout="spread">
<f:selectItem itemLabel="" itemValue="Every" />
<f:selectItem itemLabel="" itemValue="Every weekday" />
</t:selectOneRadio>
<t:radio for="myScript" index="0" />
<t:radio for="myScript" index="1" />
I am not able to view the radio buttons, where-in the same code worked properly in JSF 1.1 with the equivalent Tomahawk libraries in jboss6.
You should put what you want to show to the user in the itemLabel attribute, and a identifier in the itemValue
Like this
<t:selectOneRadio id="myScript" value="#{bean.myScript}" layout="spread">
<f:selectItem itemLabel="Every" itemValue="every" />
<f:selectItem itemLabel="Every weekday" itemValue="everyWeekday" />
</t:selectOneRadio>
<t:radio for="myScript" index="0" />
<t:radio for="myScript" index="1" />
Regards
Related
Is it possible to use or integrate themeSwitcher in a menubar
My idea is to transform this :
<p:themeSwitcher id="basic" value="#{themeSwitcherView.theme}" style="width:165px">
<f:selectItem itemLabel="Choose Theme" itemValue="" />
<f:selectItems value="#{themeSwitcherView.themes}" />
<p:ajax listener="#{themeSwitcherView.saveTheme}" />
</p:themeSwitcher>
and
public void saveTheme(AjaxBehaviorEvent ajax) {
setTheme((String) ((ThemeSwitcher)ajax.getSource()).getValue());
}
to that (begining of solution from here
<p:submenu label="Theme" >
<c:forEach items="#{themeSwitcherView.themes}" var="item">
<p:menuitem value="#{item}" actionListener="#{themeSwitcherView.saveTheme}" />
</c:forEach>
</p:submenu>
but don't work, I get the list but no action made !
thank you
I am using p:calendar Primefaces component for specifying 2 dates : start and end.
An evident control is to verify if end date is not before start date.
Is there a way to do it ?
I found the solution :
<p:outputLabel for="startDate" value="#{msg.StartDate}" />
<p:calendar id="startDate" value="#{employeeBean.employee.startDate}" required="true" pattern="dd-MM-yyyy" language="#{msg.CalendarLanguage}" mask="true"
requiredMessage="#{msg.required}">
<p:ajax event="dateSelect" update="endDate" />
</p:calendar>
<p:message for="startDate" />
<p:outputLabel for="endDate" value="#{msg.EndDate}" />
<p:calendar id="endDate" mindate="#{employeeBean.employee.startDate}" value="#{employeeBean.employee.endDate}" required="false" pattern="dd-MM-yyyy"
language="#{msg.CalendarLanguage}" mask="true">
</p:calendar>
<p:message for="endDate" />
Hi guys I have a few radio buttons that I want vertical, but I can only seem to get the horizontal.
Currently my code is:
<p:panelGrid columns="1">
<p:selectOneRadio id="options" value="{formBean.number}">
<f:selectItem itemLabel="0 - 19" itemValue="1" />
<!-- Add in the help button by the side of each item once its lined up, use a grid ?
<p:button icon="ui-icon-help" title="Help">
</p:button> -->
<f:selectItem itemLabel="20 - 39" itemValue="2" />
<f:selectItem itemLabel="40 - 49" itemValue="4" />
<f:selectItem itemLabel="50 - 59" itemValue="5" />
<f:selectItem itemLabel="60 - 69" itemValue="6" />
<f:selectItem itemLabel="70 - 79" itemValue="7" />
<f:selectItem itemLabel="80 - 100" itemValue="8" />
</p:selectOneRadio>
</p:panelGrid>
How can I change it from horizontal to vertical, I have tried the grid way but still the same.
Thanks guys
EDIT
i have now achieved what i set out :
<p:panelGrid columns="1">
<p:selectOneRadio id="options" value="{formBean.number}" layout="grid" columns="1" required = "True"
requiredMessage="#{bundle.requiredGender}">
<f:selectItem itemLabel="0 - 19" itemValue="1" />
<f:selectItem itemLabel="20 - 39" itemValue="2" />
<f:selectItem itemLabel="40 - 49" itemValue="4" />
<f:selectItem itemLabel="50 - 59" itemValue="5" />
<f:selectItem itemLabel="60 - 69" itemValue="6" />
<f:selectItem itemLabel="70 - 79" itemValue="7" />
<f:selectItem itemLabel="80 - 100" itemValue="8" />
</p:selectOneRadio>
</p:panelGrid>
only issue is now the grid is the size of the page, any way this can be aligned to left and made only the size of the labes ?
Use the layout attribute on p:selectOneRadio with value pageDirection.
Here are possible values for layout:
lineDirection - For Horizontal Direction
pageDirection - For Vertical direction.
grid - For a grid pattern
pageDirection - For Vertical direction.
responsive - For dynamically using the space provided
custom - For custom Layout.
Example
I have simple flow of 3 tabs. I have tested the Simple tabview example on showcase.
But When I change the first tab with my content, I can't switch to other tabs.
Kindly guide me with what is wrong that needs to be changed.
Earlier I was using Wizard but I had the same tab change problem there as clicking on next was taking me to the last tab everytime.
and Now facing other issue with Tabview
I am posting the code:
<h:form id="compositionmaster">
<p:tabView id="tabView">
<p:tab id="tab1" title="Committee Details">
<h:panelGrid columns="2" columnClasses="label, value">
<h:outputText value="Committee Type: " />
<p:selectOneMenu id="type" value="#{userWizard.comm.committeeType}" effect="fade">
<f:selectItem itemLabel="----Select----" itemValue="0" />
<f:selectItem itemLabel="New" itemValue="1" />
<f:selectItem itemLabel="Existing" itemValue="2" />
</p:selectOneMenu>
<h:outputText value="Concerned Division: " />
<p:selectOneMenu id="division" value="#{userWizard.comm.committeeSubType}" effect="fade">
<f:selectItem itemLabel="----Select----" itemValue="0" />
<f:selectItem itemLabel="Administration" itemValue="1"/>
<f:selectItem itemLabel="Finance" itemValue="2" />
<f:selectItem itemLabel="Marketing" itemValue="3" />
<f:selectItem itemLabel="Others" itemValue="4" />
</p:selectOneMenu>
<h:outputText value="Committee Name: " />
<p:inputText value="#{userWizard.comm.committeeName}" maxlength="100"/>
<h:outputText value="Subject: " />
<p:inputText value="#{userWizard.comm.committeeSubject}" maxlength="100" />
<h:outputText value="Description: " />
<p:inputText value="#{userWizard.comm.committeeDescription}" maxlength="500" />
<h:outputText value="Tenure of Committee: " />
<p:panelGrid columns="2" >
<p:inplace id="Tenure" label="From">
<p:calendar value="#{userWizard.comm.startDate}" id="start" showOn="button" />
</p:inplace>
<p:inplace label="To">
<p:calendar value="#{userWizard.comm.endDate}" id="end" showOn="button" />
</p:inplace>
</p:panelGrid>
<h:outputText value="Add Document: " />
<h:form enctype="multipart/form-data">
<p:fileUpload fileUploadListener="#{fileBean.handleFileUpload}" mode="advanced" update="messages" multiple="true" sizeLimit="100000" allowTypes="/(\.|\/)(gif|jpe?g|png|doc|pdf)$/"/>
</h:form>
</h:panelGrid>
</p:tab>
<p:tab id="tab2" title="Godfather Part II">
<h:panelGrid columns="2" cellpadding="10">
<h:outputText id="tab2Text" value="stature grows."/>
</h:panelGrid>
</p:tab>
<p:tab id="tab3" title="Godfather Part III">
<h:panelGrid columns="2" cellpadding="10">
<h:outputText id="tab3Text" value="After a promise that his family would one day be completely legitimate."/>
</h:panelGrid>
</p:tab>
</p:tabView>
</h:form>
Don't use nested forms
HTML doesn't allow nested forms, so you shouldn't use them in primefaces either.They can cause undesired behavior.
See: other stackoverflow questions, or a nice collection of things to avoid in JSF: here (note point 2)
This is the only problem I see in your code. Other than that in rare cases you might have problems if using ajax and not processing the whole form. But as I can see this is not the case in your code.
I am working on webflow 2.3.1, primefaces 3.4.2 project.
As you see, i tried to update selectOneMenu according to parent city as shown at example from primefaces showcase. However i used p:remoteCommand to call webflow action.
At remoteCommand , if i set process="#this, subSelectOneMenu", action did not call . But if i did not set "process",it called action but it also give error for captcha which is empty.
How can i use remoteCommand to call action partially?
<h:form id="signUpUserInfo">
<p:panelGrid id="grid" columns="2">
<p:selectOneMenu id="citySelectOneMenu" value="#{userBean.address.cityId}" label="#{label.address_city}" onchange="selectionChanged()">
<f:selectItem itemValue="" itemLabel="" />
<f:selectItems value="#{flowScope.cityList}" />
</p:selectOneMenu >
<p:selectOneMenu id="subSelectOneMenu"
value="#{userBean.address.subId}" label="#{label.address_sub}">
<f:selectItem itemValue="" itemLabel="" />
<f:selectItems value="#{flowScope.subList}" />
</p:selectOneMenu>
<p:captcha id="captcha" label="Captcha" language="en" theme="white" required="true" secure="true" />
<f:facet name="footer">
<p:commandButton id="save" value="#{label.save_button}" ajax="false"
action="signUpStandartMember" update="signUpUserInfo" />
</f:facet>
</p:panelGrid>
<p:remoteCommand id="selectionChanged" name="selectionChanged" action="cityChangedAction" update="subSelectOneMenu" process="#this, subSelectOneMenu" />
</h:form>