I am using a4j:commandButton it's not picking up the ternary operator.
Here is the code:
<a4j:commandButton styleClass="btn large" execute="@this phone-field phone-cc-field" render="mobilemessage-overlay"
value="Send" action="#{successBean.sendMobileMessage}" oncomplete="#{successBean.clearMessage} ? #{rich:component('mobilemessage-overlay')}.show(); : return false;">
</a4j:commandButton>
My expectation is once successBean.clearMessage=true it should populate the modal(mobilemessage-overlay) otherwise not.
Currently its not populating the modal in any scenario.
Any help would be really appreciated.
You can just use "if", oncomplete doesn't need to return anything.
Anyway, you should be seeing an error in the console. The problem is that
true ? someFunction() : return false
is not valid JavaScript becausereturn false
is not an expression.Now if for some reason you needed the return you could do it like this: