【问题标题】:computed field value in xpagesxpages 中的计算字段值
【发布时间】:2012-04-11 02:40:58
【问题描述】:

我正在尝试通过单击按钮来更新计算字段值,该按钮的值是编辑框 + 它自己的值。

按钮上编写的代码:这里我将编辑框的值放在范围变量中,并将编辑框设为空白。 comment_te 是编辑框的名称

requestScope.put("commentValue", getComponent("comments_te").getValue);
getComponent("comments_te").setValue(""); 

为计算域的值编写的代码:cmets 是计算域的名称

getComponent("comments").getValue + "\n" + requestScope.get("commentValue")

但我得到的输出是: 0 com.ibm.xsp.component.xp.XspInputText@65426542

请帮帮我。

【问题讨论】:

    标签: lotus-notes xpages lotus-domino


    【解决方案1】:

    您在调用 getValue() 时缺少括号。通过省略这些,您将返回一个指向组件的 getValue 方法的指针,而不是调用该方法的结果。将每个对 getValue 的引用改为 getValue(),你会得到不同的结果。

    【讨论】:

      【解决方案2】:

      您的代码返回对象。 试试下面的。 以下代码获取编辑框值并设置为范围变量。

      requestScope.commentValue = getComponent("comments_te").value;
      getComponent("comments_te").value = "";
      

      以下代码将值设置为计算域。

      getComponent("comments").value = getComponent("comments").value + "\n" + requestScope.commentValue;
      

      当您将值附加到计算字段时,默认情况下它会将 0 添加到其值。如果需要,请进行验证。

      希望对你有帮助...!!!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-07-19
        • 2011-05-30
        • 2015-10-19
        • 1970-01-01
        相关资源
        最近更新 更多