2017-01-17 52 views
0

我正在使用a4j:commandButton它不拾取三元運算符。a4j:commandButton三元運算符不工作完成

下面是代碼:

<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> 

我的期望是,一旦successBean.clearMessage =真應該填充模式(mobilemessage疊加),否則不是。

目前它沒有在任何情況下填充模式。

任何幫助將非常感激。

回答

2

你可以使用「if」,oncomplete不需要返回任何東西。

無論如何,你應該看到在控制檯中的錯誤。問題是true ? someFunction() : return false不是有效的JavaScript,因爲return false不是表達式。

現在,如果由於某種原因,你需要,你可以做這樣的回報:

#{bean.isValid ? 'someFunction()' : 'return false'} 
+0

如果作品對我很好。 – user3352615