Hi,
I use OPS to develop a web application. And I have a problem with 'submission' element. I want to pass a instance to service and then return a instance, then use the returned instance replace a node of another instance in page. for example:
<xforms:instance id="send">
<!--send data-->
</xforms:instance>
<xforms:instance id="receive">
<form>
<books/>
<products>
</form>
</xforms:instance>
<xforms:submission
ref="instance('send')"
replace="instance"
instance="receive"
target="form/books"
method="post"
action="/service">
Then, the returned xml of submisssion will replace "instance('receive')/form/books" node.
Should you support this? How can I do it? This is very important in my application.
There is XForms 1.1 working draft description:
4.1.5 Replacing Text with a Submission Response
In XForms 1.1, the replace
attribute of submission
supports the additional value of text
. If this setting is made, and the submission response conforms to an XML mediatype (as defined by the content type specifiers in [RFC 3023]) or a text media type (as defined by a content type specifier of text/*
), then the response data is encoded as text and replaces the content of the replacement target node
. See 4.1.6 The target Attribute on Element submission for further information about the replacement target node. If the content type of the submission response is not an XML mediatype or text mediatype as defined above, then the submission ends after dispatching the event xforms-submit-error
with an error-type
of resource-error
.
4.1.6 The target Attribute on Element submission
The submission
element must allow a new optional attribute named target
of type string. The attribute value is interpreted as an XPath expression returning a node-set, the first node of which is used as the replacement target node
for the submission response.
The default replacement target node is the document element node of the instance identified by the instance
attribute, which is equal to the default instance of the model if not specified. The evaluation context for this attribute is the in-scope evaluation context for the submission
element, except the context node is modified to be the document element of the instance identified by the instance
attribute if it is specified.
This attribute is evaluated only once a successful submission response has been received and if the replace
attribute value is instance
or text
. If the evaluation of the target
attribute produces an empty nodeset or a nodeset in which the first node is not an element node, then submission processing ends after dispatching the event xforms-submit-error
with an error-type
of target-error
.
When the replace
attribute contains the value text
, then the replacement target node is used as described in 4.1.5 Replacing Text with a Submission Response. When the replace
attribute contains the value instance
, then the XML obtained from the submission response is used to replace the target node. The XML in the response may have comment and processing instruction nodes before and after the document element. These nodes are discarded if the replacement target node is not the document element of an instance. Otherwise, those processing instructions and comments replace any processing instructions and comments that previously appeared outside of the document element of the instance being replaced.
你 邮 箱 里 居 然 有 积 分 , 这 你 知 道 吗 ?
邮 箱 积 分 居 然 能 换 20 元 钱 , 这 你 也 知 道 吗 ? 点 此 兑 换 20 元 >>
--
You receive this message as a subscriber of the
[hidden email] mailing list.
To unsubscribe: mailto:
[hidden email]
For general help: mailto:
[hidden email]?subject=help
ObjectWeb mailing lists service home page:
http://www.objectweb.org/wws