我有以下XPage,一个checkboxgroup和一个computedfield
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:panel id="ref">
<xp:checkBoxGroup id="checkBoxGroup1">
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:var val = ["Test1", "Test2"];
return val}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler event="onchange" submit="true"
refreshMode="partial" refreshId="ref">
</xp:eventHandler>
</xp:checkBoxGroup>
<xp:text escape="true" id="computedField3">
<xp:this.value><![CDATA[#{javascript:typeof getComponent("checkBoxGroup1").getValue()}]]></xp:this.value>
</xp:text>
<xp:br></xp:br>
</xp:panel>
</xp:view>
当我单击复选框时,我期望计算字段返回一种类型的数组,而是返回[Ljava.lang.String
如何更改我的代码,以便如果我选择一个或多个复选框,computedField将返回“数组”或“向量”的类型
在OpenNTF Snippets网站https://openntf.org/XSnippets.nsf/snippet.xsp?id=convert-any-value-to-an-array上试试这个片段