1

I would like to use jQuery to change the checked status of the radio button of Primefaces. But the only thing I am able to set is: disabled=false/true.

I think it is possible to do this with jQuery, but I cannot see the dot inside the Radio-Button, probably because Primefaces is using an image for this.

Does someone know how to change the checked-status of a radiobutton within Primefaces? Additionally I have to be able to fetch the state of the single radiobutton.

Jonas
  • 121,568
  • 97
  • 310
  • 388
user1878408
  • 5
  • 1
  • 4
  • are you sure you would go with radio buttons, and not checkboxes? (you can style them like radio)... Also: put some example code. How many options your checkbox has? – Mindwin Remember Monica Dec 07 '12 at 13:32

1 Answers1

1

SelectOneRadio has no checked attribute. see documentation.

You seem to be looking for a SelectBooleanCheckbox, or for how to find the checked value of a SelectBooleanCheckbox

You can get the value of the SelectOneRadio via javascript using the solution posted in this answer. It can be modified easily to get the selected value of the radio buttons.

But the real answer to your question is:

There is no such thing as a checked attribute to the <p:selectOneRadio> element. If you want one, you will have to extend the component classes.

Community
  • 1
  • 1
Mindwin Remember Monica
  • 1,469
  • 2
  • 20
  • 35