Search code examples
htmljsfxpages

setting disabled property on multiple controls at once


I want to steer the disabled property for different types of controls (edit box, combo lists, text area, ...) at once and not per control.

Is this possible and how?

On a theme you can compute the property of a control e.g.

<property>
    <name>pageTitle</name>
    <value>#{javascript:@DbTitle()}</value>
 </property>

But in my application I have different types of objects managed via different beans (e.g. order/orderbean, customer/customerbean) so I doubt I can set it via the theme?

I am not sure if I can set it "temporarily" for a specific xpage via the FacesContext?


Solution

  • Easiest way is to compute the value and point to a Boolean scope variable. viewScope.somevar.

    You change the value of the scope variable and all controls update accordingly

    Other option: if the components are together: pack them in a panel and compute its visibility