selectoneradio

How to get the selected option from p:selectOneRadio using javascript

隐身守侯 提交于 2019-12-05 18:59:08
How do you get which radio is selected within p:selectOneRadio using javascript/jquery ? Since the p:selectOneRadio uses no radio tags I have no idea how to get the checked option using CSS selectors. <p:selectOneRadio onchange="reactToChangedRadio()" > <f:selectItem itemLabel="....." itemValue="..." /> <f:selectItem itemLabel="....." itemValue="..." /> <f:selectItem itemLabel="....." itemValue="..." /> </p:selectOneRadio> You can use the jquery solution or choose a simple javascript solution: document.getElementById("myFormId:mySelectId")[0].checked See the post from CodeRanch: http://www

How to use h:selectOneRadio in h:dataTable to select single row?

﹥>﹥吖頭↗ 提交于 2019-12-03 10:09:06
问题 I have list of pages displayed in table. Each page has property homePage and I want in the datatable to have a column of radio buttons to be binded on this property, and the user can only check one value. How can I get this value on server side? I saw some examples like the following: http://jforum.icesoft.org/JForum/posts/list/14157.page, but I would like to know what is the best practice in such case. 回答1: As per JSF spec issue 329 I have finally implemented it for JSF 2.3. With the new

How to set the value of p:selectOneRadio with Client Side API?

老子叫甜甜 提交于 2019-11-30 16:06:55
In my JSF view I am using a p:selectOneRadio . Now I have to change the value of this component on client side as side effect. In the Client Side API of this component I have found the following which I think I could use for this if I find the proper way how to use it: PrimeFaces.widget.SelectOneRadio=PrimeFaces.widget.BaseWidget.extend( { // ... select:function(a){ this.checkedRadio=a; a.addClass("ui-state-active") .children(".ui-radiobutton-icon") .addClass("ui-icon-bullet").removeClass("ui-icon-blank"); a.prev().children(":radio").prop("checked",true)} }); To me (without having much

Primefaces selectOneRadio ajax

☆樱花仙子☆ 提交于 2019-11-30 07:55:55
问题 I'm trying to display validation messages everytime the user clicks on a radio button. This only works when I click on the submit button, but not when I click on the radio button: <h:form id="form"> <p:panel id="panel"> <ui:repeat value="#{questionsBean}" var="question"> <h:panelGrid columns="3" style="margin-bottom:10px" cellpadding="5"> <h:outputText value="#{question.questionText}" /> <p:selectOneRadio id="question" value="#{question.response}" validator="#{question.validate}" required=

How to set the value of p:selectOneRadio with Client Side API?

ぐ巨炮叔叔 提交于 2019-11-29 23:48:40
问题 In my JSF view I am using a p:selectOneRadio. Now I have to change the value of this component on client side as side effect. In the Client Side API of this component I have found the following which I think I could use for this if I find the proper way how to use it: PrimeFaces.widget.SelectOneRadio=PrimeFaces.widget.BaseWidget.extend( { // ... select:function(a){ this.checkedRadio=a; a.addClass("ui-state-active") .children(".ui-radiobutton-icon") .addClass("ui-icon-bullet").removeClass("ui

“Validation Error: Value is not valid” error from f:datetimeConverter

醉酒当歌 提交于 2019-11-28 01:32:27
The following code creates a two radio buttons. Each option contains a date value that is successfully converted to a label of the format "yyyy-MM-dd". Once I make a selection and click the next button I get the following error "j_idt12:comDateChoice: Validation Error: Value is not valid". It seems simple enough but somethings wrong. Can any of you spot it? I'm using JSF 2.0 in glassfish. Backing bean public List<SelectItem> getComDateList() { List<SelectItem> items = new ArrayList<SelectItem>(); Calendar cal = GregorianCalendar.getInstance(); cal.set(Calendar.DAY_OF_MONTH, 1); cal.add

“Validation Error: Value is not valid” error from f:datetimeConverter

て烟熏妆下的殇ゞ 提交于 2019-11-26 23:33:35
问题 The following code creates a two radio buttons. Each option contains a date value that is successfully converted to a label of the format "yyyy-MM-dd". Once I make a selection and click the next button I get the following error "j_idt12:comDateChoice: Validation Error: Value is not valid". It seems simple enough but somethings wrong. Can any of you spot it? I'm using JSF 2.0 in glassfish. Backing bean public List<SelectItem> getComDateList() { List<SelectItem> items = new ArrayList<SelectItem

<h:selectOneRadio> renders table element, how to avoid this?

删除回忆录丶 提交于 2019-11-26 05:18:31
Is there a way to tell JSF that it should NOT render a <table> element when using <h:selectOneRadio> ? I don't use tables and it makes absolutely no sense in this case. Any help is appreciated! BalusC JSF 2.3 with group attribute As per JSF spec issue 329 I have added a new group attribute to <h:selectOneRadio> which should make this all much less tedious. All radio button components having the same group value within a parent UIForm will be grouped with each other. Also they won't render any markup besides the radio button itself and the optional label if the select item has a non-null label

<h:selectOneRadio> renders table element, how to avoid this?

梦想的初衷 提交于 2019-11-26 01:54:43
问题 Is there a way to tell JSF that it should NOT render a <table> element when using <h:selectOneRadio> ? I don\'t use tables and it makes absolutely no sense in this case. Any help is appreciated! 回答1: JSF 2.3 with group attribute As per JSF spec issue 329 I have added a new group attribute to <h:selectOneRadio> which should make this all much less tedious. All radio button components having the same group value within a parent UIForm will be grouped with each other. Also they won't render any