简体   繁体   English

XForms:如何在JavaScript函数中使用实例值?

[英]XForms: How to use instance value in JavaScript function?

I want to use a value from one of my XForms instances, which is populated via a web service, as a parameter to a JavaScript function, I cannot seem to get working. 我想使用一个XForms实例中的一个值(该值通过Web服务填充)作为JavaScript函数的参数,我似乎无法正常工作。

Something like: 就像是:

 <xxf:script>
      var val = ORBEON.xforms.Document.getValue(instance('fr-service-response-instance')//*:MyValue);
      alert(val);
 </xxf:script>

The question is how do I get the value of "MyValue" from the instance? 问题是如何从实例中获取“ MyValue”的值? The above code throws an Orbeon exception. 上面的代码抛出Orbeon异常。

The ORBEON.xforms.Document.getValue() function can only access the value of a control present on the page. ORBEON.xforms.Document.getValue()函数只能访问页面上存在的控件的值。 It does not provide access to arbitrary instance data, for security reasons. 出于安全原因,它不提供对任意实例数据的访问。

If you want to expose the value of instance data which does not have an associated control, you need to create such a control. 如果要公开没有关联控件的实例数据的值,则需要创建这样的控件。 You can for example use a hidden Text Output / Calculated Value field. 例如,您可以使用隐藏的“文本输出/计算值”字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM