【问题标题】:a4j:commandButton ternary operator is not working oncompletea4j:commandButton 三元运算符不完整
【发布时间】:2017-01-17 19:46:58
【问题描述】:

我正在使用 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=true 它应该填充模态(mobilemessage-overlay),否则不会。

目前它在任何情况下都不会填充模式。

任何帮助将不胜感激。

【问题讨论】:

    标签: javascript jsf xhtml richfaces richfaces-modal


    【解决方案1】:

    你可以只使用“if”,oncomplete不需要返回任何东西。

    无论如何,您应该会在控制台中看到一个错误。问题是 true ? someFunction() : return false 不是有效的 JavaScript,因为 return false 不是表达式。

    现在,如果由于某种原因您需要退货,您可以这样做:

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

    【讨论】:

      猜你喜欢
      • 2015-12-18
      • 1970-01-01
      • 2012-07-25
      • 2015-07-13
      • 2017-05-23
      • 1970-01-01
      • 2018-09-10
      相关资源
      最近更新 更多