1

I have a JavaScript function that's called when a selectManyCheckbox selection is made. In that function, depending on the selections, I need to enable or disable various form elements on the page. I'm using PrimeFaces widgetVars to get a handle on the element object. I've been able to figured out how to enable/disable every other type of page element except for the selectOneRadio group.

The PrimeFaces widgetVar object provides disable and enable functions for a few element types such as inputText, selectOneMenu and calendar.

PF('widget_dropdown').disable() and PF('widget_dropdown').enable();

The PrimeFaces widgetVar object provides a function to get the JQuery object like this:

PF('widget_radio').getJQ();

For checkboxes I was able to use the JQuery functions such as:

PF('widget_checkbox').getJQ().attr("disabled",true) and PF('widget_checkbox').getJQ().removeAttr('disabled');

But, for the selectOneRadio, I've tried many different variations of JQuery solutions that work for other folks, but will not using PF widgetVar or the JQuery object returned by the PF widgetVar. Anyone have ideas?

J. Van
  • 190
  • 1
  • 17
  • Look into [**addEventListener**](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener) to bind an event to an element with JavaScript. See [**Checkbox Check Event Listener**](https://stackoverflow.com/questions/14544104/checkbox-check-event-listener) If you start having issues, please post the relevant Markup and JavaScript code. Also see [**How do I ask a good question**](https://stackoverflow.com/help/how-to-ask) and [**How to create a Minimal, Complete, and Verifiable example**](https://stackoverflow.com/help/mcve) – Nope Oct 19 '17 at 12:03
  • I answered my own question. PF('widget_radio').disable() works. When I tested prior and it didn't work, it was most likely that I was throwing an exception before it and was probably never executed. This was my first post, I'll continue to work on making them better in future. – J. Van Oct 20 '17 at 15:10

0 Answers0