Orbeon:客户端JavaScript API - 无法找到元素

时间:2016-02-29 18:22:16

标签: orbeon

我的表单上有一个简单的xxf:script

<xxf:script ev:event="DOMActivate">
 var msg = ORBEON.xforms.Document.getValue("ctl-input");
  window.alert("Input: " + msg);
</xxf:script>

它应该在以下模型中查找ctl-input

<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all">
<form>
    <section-3>
        <ctl-input/>
        <ctl-show/>
    </section-3>
</form>
</xf:instance>

但是当它运行时,它会退出并出现以下错误:

   Uncaught Cannot find control id ctl-input_.extend._findControl 
    @ orbeon-e5b0ff6755fd59a52104ecab42b16b473214055e.js:138_.extend.getValue 
    @ orbeon-e5b0ff6755fd59a52104ecab42b16b473214055e.js:138xf_861cb11f4997109affb7913426a4f463e1ad2cb0 
    @ new:104Server.callUserScript 
    @ orbeon-e5b0ff6755fd59a52104ecab42b16b473214055e.js:132AjaxServer.handleResponseDom 
    @ orbeon-e5b0ff6755fd59a52104ecab42b16b473214055e.js:133AjaxServer.handleResponseAjax 
    @ orbeon-e5b0ff6755fd59a52104ecab42b16b473214055e.js:133YAHOO.util.Connect.handleTransactionResponse 
    @ orbeon-e5b0ff6755fd59a52104ecab42b16b473214055e.js:56(anonymous function) 
    @ orbeon-e5b0ff6755fd59a52104ecab42b16b473214055e.js:56

知道这里出了什么问题吗?

1 个答案:

答案 0 :(得分:0)

ORBEON.xforms.Document.getValue()获取控件的id。如果您在表单生成器中创建了表单,则id由您提供的名称组成,后缀为-control。所以你很可能想打电话:

ORBEON.xforms.Document.getValue("ctl-input-control")