I would like to disable a button in primefaces in the case of any one of the conditions is met. For example:
I have the commandButton:
<p:commandButton value="Check" actionListener="#{myBean.someMethod()}"
disabled="#{myBean.contador1 eq 0} ">
It works ok. However, I want to check another condition to disable the button too.
disabled="#{myBean.contador2 eq 100} ">
If I try one of them separately, the button is disabled. However, when I try to join both conditions, none of them works. I’ve tried:
disabled="#{myBean.contador1 eq 0} || #{myBean.contador2 eq 100} ">
disabled="#{myBean.contador1 eq 0} or #{myBean.contador2 eq 100} ">
disabled="#{myBean.contador1 eq 0} , #{myBean.contador2 eq 100} ">
disabled="#{myBean.contador1 eq 0} #{myBean.contador2 eq 100} ">
Any suggestion? Thanks in advance.
I think this is the right syntax
disabled="#{myBean.contador1 eq 0 or myBean.contador2 eq 100} ">
You basically start EL expression (#{}
) only once, no matter how many beans you are going to call inside it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With