2016-02-29 48 views
0

我的窗體上有一個小小的xxf:scriptOrbeon:客戶端的JavaScript API - 找不到元素

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

但是當它:

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

應該在以下模型查找​​它運行,它退出時出現以下錯誤:

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 

任何想法發生了什麼問題h ERE?

回答

0

ORBEON.xforms.Document.getValue()取得控件的ID。如果您在Form Builder中創建了該表單,則該ID由您給出的名稱組成,後綴爲-control。所以,你很可能會想打電話:

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

並沒有解決我的問題,發佈了[跟進問題(http://stackoverflow.com/questions/35741178) – gubaer

+0

明白了,我會看看這個單獨的問題。 – avernet