Hello!
Not sure how to word what I am doing, so correct me please if I am wrong.
Here is what I am trying to do.
I have a xbl component with a bunch of fields and data, now some of these
fields I want to be populated from a rest call to another service based off
the values entered so far. I have the search and submission working, I get a
list of results back that fit the search criteria. Now I want to way to copy
(lets say the first result) back into the forms model.
<xbl:binding id="workflow-episode-details"
element="workflow|episode-details" xxbl:mode="lhha binding">
...
<xbl:template>
<xf:model id="local-model">
<xf:instance>
<episode-details>
....
</episode-details>
</xf:instance>
<xf:submission id="dmr-test-submission"
resource="
http://localhost:8080/episode"
method="post"
ref="instance('episode-search-data')"
serialization="application/xml"
mediatype="application/xml"
replace="instance"
instance="episode-search-results"
xxf:username=""
xxf:password=""/>
<xf:instance id="episode-search-data">
<episode-details/>
</xf:instance>
<xf:instance id="episode-search-results">
<results/>
</xf:instance>
</xf:model>
</xbl:template>
<xf:group id="workflow-component-group" model="local-model">
<xf:var name="binding"
value="xxf:binding('workflow-episode-details')" />
....
<xf:trigger id="episode-search-buttom">
<xf:label>Search</xf:label>
<xf:action ev:event="DOMActivate">
<xf:setvalue
ref="instance('episode-search-data')/episodeId" value="$binding/EpisodeId"/>
<xf:action ev:event="DOMActivate">
<xf:send submission="dmr-test-submission"/>
</xf:action>
<xf:action ev:event="DOMActivate"
if="count-non-empty(instance('episode-search-results')/results) > 0">
<xf:setvalue ref="$binding"
value="instance('episode-search-results')/results[1]"/>
</xf:action>
</xf:action>
</xf:trigger>
</xbl:binding>
Some things to node, The list of results from the submission have an
identically structure to the local-model, I am getting a list of results
back and am currently just trying to copy the first result back into the
binding.
Thanks for your time in reading this and I hope is isn't to hard to read.
Joel.
--
Sent from:
http://discuss.orbeon.com/