Accessing Form-Data from within XBL

1 view
Skip to first unread message

Joel Oates

unread,
Jun 30, 2019, 10:46:09 PM6/30/19
to orb...@googlegroups.com
Hello!

We are using Orbeon forms with a workflow implementation to display data to
the user and using the Orbeon submissions to control the workflow (through
rest), Now onto my current issue, I have all the data from my workflow that
I want to display, and I have a few XBL components that need this data, I
was previously inserting the data directly into the controls inside the
fr-form-instance.

For Example.

<form>
<section-1>
<Patient>
<firstName>John</firstname>
</Patient>
</section-1>
</form>

Now the issue with this is that the controls of the XBL have to be named
Patient (or what ever the data is) now, I have data that needs to be
referenced by multiple XBL components. I was going to use the
*xxf:instance('fr-form-instance')* to access the data that I put inside the
main section for example.

<form>
<section-1>
<patient-xbl/>
<booking-xbl/>
<Patient-Data>
<firstName>John</firstname>
</Patient-Data>
</section-1>
</form>

Now I want the patient-xbl and the booking-xbl both to be able to reference
the /Patient-Data/, I was attempting to do this with the
*xxf:instance('fr-form-instance')* but had no luck getting anything.

Sorry if my point hasn't come across property or if my explanation is not
clear.

Is there a standard way of doing this?

Thanks for your time.
Joel.

--
Sent from: http://discuss.orbeon.com/

Joel Oates

unread,
Jul 1, 2019, 1:31:05 AM7/1/19
to orb...@googlegroups.com
So I've found a work around for this with help to Eric's Post
(https://gist.github.com/ebruchez/8d7e9ebd7f7b90911ecb)

I created a hidden section to which I put all my data, then in my xbl I got
my current binding, found the root and then dived down to find my data.

Code

*Form fr-instance*

<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all"
xxf:index="id">
<form>
<section-1>
<Patient-display></Patient-display>
<controls></controls>
<workflow-data></workflow-data>
</section-1>
</form>
</xf:instance>

*Xbl Control (Binding ID: workflow-coding-status)*

<xf:var name="binding"
value="xxf:binding-context('workflow-coding-status')/root()//*[name() =
'workflow-data']" />


This the variable binding will now have all the data that I required..

Alessandro Vernet

unread,
Jul 1, 2019, 1:49:19 PM7/1/19
to orb...@googlegroups.com
Thank you Joel for re-sharing that
`xxf:binding-context('workflow-coding-status')/root()//*[name() =
'workflow-data']` trick to access data outside of the XBL component from
inside the component.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply all
Reply to author
Forward
0 new messages