Here is the problem I use xforms insert for adding another element but when I try to fill it, it copies value of the field to the rest of them i.e. if I add three fields and then write in field number 2 test it copies to fields 1, 3. I would be grateful for any kind of help.
<xforms:trigger appearance="minimal"
bind="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc-bind" class="section">
<xforms:label>
<img src="https://epuap.gov.pl/orbeon_portal/apps/edytor/images/add.gif"/>
</xforms:label>
<xforms:insert
at="index('SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc-repeat')"
context="instance('main')/wnio:TrescDokumentu/wnio:Zgloszenia/wnio:ZgloszenieZamiaruUmieszczeniaSzylduNaObiekcieBudowlanym/wnio:OswiadczenieOPosiadanymPrawieDoDysponowaniaNieruchomoscia/wnio:TytulPrawnyUzytkowanejNieruchomosci/wnio:Wspolwlasnosc/wnio:Wspolwlasciciele"
ev:event="DOMActivate"
nodeset="wnio:WspolwlascicielNieruchomosci"
origin="instance('kopia_main')/wnio:TrescDokumentu/wnio:Zgloszenia/wnio:ZgloszenieZamiaruUmieszczeniaSzylduNaObiekcieBudowlanym/wnio:OswiadczenieOPosiadanymPrawieDoDysponowaniaNieruchomoscia/wnio:TytulPrawnyUzytkowanejNieruchomosci/wnio:Wspolwlasnosc/wnio:Wspolwlasciciele/wnio:WspolwlascicielNieruchomosci" position="after"/>
</xforms:trigger>
<xforms:trigger appearance="minimal"
bind="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc-bind" class="section">
<xforms:label>
<img src="https://epuap.gov.pl/orbeon_portal/apps/edytor/images/remove.gif"/>
</xforms:label>
<xforms:delete
at="index('SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc-repeat')"
context="instance('main')/wnio:TrescDokumentu/wnio:Zgloszenia/wnio:ZgloszenieZamiaruUmieszczeniaSzylduNaObiekcieBudowlanym/wnio:OswiadczenieOPosiadanymPrawieDoDysponowaniaNieruchomoscia/wnio:TytulPrawnyUzytkowanejNieruchomosci/wnio:Wspolwlasnosc/wnio:Wspolwlasciciele"
ev:event="DOMActivate"
nodeset="wnio:WspolwlascicielNieruchomosci"/>
</xforms:trigger>
</xhtml:td>
</xhtml:tr>
<xforms:repeat
_bind="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc-bind"
id="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc-repeat"
nodeset="//wnio:TrescDokumentu/wnio:Zgloszenia/wnio:ZgloszenieZamiaruUmieszczeniaSzylduNaObiekcieBudowlanym/wnio:OswiadczenieOPosiadanymPrawieDoDysponowaniaNieruchomoscia/wnio:TytulPrawnyUzytkowanejNieruchomosci/wnio:Wspolwlasnosc/wnio:Wspolwlasciciele/wnio:WspolwlascicielNieruchomosci">
<xhtml:tr>
<xhtml:tr>
<xhtml:td
xmlns:fb="http://orbeon.org/oxf/xml/form-builder" xmlns:xbl="http://www.w3.org/ns/xbl">
<xforms:input
bind="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc__wnio.Wspolwlasciciele-bind"
id="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc__wnio.Wspolwlasciciele-control">
<xforms:label ref="$form-resources/TytulPrawnyUzytkowanejNieruchomosci/Wspolwlasnosc/Wspolwlasciciele/label"/>
<xforms:hint ref="$form-resources/TytulPrawnyUzytkowanejNieruchomosci/Wspolwlasnosc/Wspolwlasciciele/hint"/>
<xforms:help ref="$form-resources/TytulPrawnyUzytkowanejNieruchomosci/Wspolwlasnosc/Wspolwlasciciele/help"/>
<xforms:alert ref="$form-resources/TytulPrawnyUzytkowanejNieruchomosci/Wspolwlasnosc/Wspolwlasciciele/alert"/>
</xforms:input>
</xhtml:td>
</xhtml:tr>
<xhtml:tr>
<xhtml:td>
<xforms:input
bind="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc__wnio.Wspolwlasciciele__wnio.WspolwlascicielNieruchomosci-bind"
id="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc__wnio.Wspolwlasciciele__wnio.WspolwlascicielNieruchomosci-control">
<xforms:label ref="$form-resources/TytulPrawnyUzytkowanejNieruchomosci/Wspolwlasnosc/Wspolwlasciciele/WspolwlascicielNieruchomosci/label"/>
<xforms:hint ref="$form-resources/TytulPrawnyUzytkowanejNieruchomosci/Wspolwlasnosc/Wspolwlasciciele/WspolwlascicielNieruchomosci/hint"/>
<xforms:help ref="$form-resources/TytulPrawnyUzytkowanejNieruchomosci/Wspolwlasnosc/Wspolwlasciciele/WspolwlascicielNieruchomosci/help"/>
<xforms:alert ref="$form-resources/TytulPrawnyUzytkowanejNieruchomosci/Wspolwlasnosc/Wspolwlasciciele/WspolwlascicielNieruchomosci/alert"/>
</xforms:input>
</xhtml:td>
</xhtml:tr>
</xforms:repeat>
bindings for repeat
<xforms:bind
id="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc-root-bind"
name="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci__wnio.Wspolwlasnosc-root"
nodeset="wnio:Wspolwlasnosc"
relevant="$SZ_wnio.OswiadczenieOPosiadanymPrawieDoDysponowaniaNieruchomoscia__wnio.TytulPrawnyUzytkowanejNieruchomosci='wspolwlasnosc'" required="true()"/>
<xforms:bind
id="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc-bind"
name="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci__wnio.Wspolwlasnosc"
nodeset="wnio:Wspolwlasnosc/wnio:Wspolwlasciciele/wnio:WspolwlascicielNieruchomosci"
relevant="$SZ_wnio.OswiadczenieOPosiadanymPrawieDoDysponowaniaNieruchomoscia__wnio.TytulPrawnyUzytkowanejNieruchomosci='wspolwlasnosc'" required="true()">
<xforms:bind
id="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc__wnio.Wspolwlasciciele-bind"
name="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc__wnio.Wspolwlasciciele"
nodeset="wnio:TrescDokumentu/wnio:Zgloszenia/wnio:ZgloszenieZamiaruUmieszczeniaSzylduNaObiekcieBudowlanym/wnio:OswiadczenieOPosiadanymPrawieDoDysponowaniaNieruchomoscia/wnio:TytulPrawnyUzytkowanejNieruchomosci/wnio:Wspolwlasnosc/wnio:Wspolwlasciciele"/>
<xforms:bind
id="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc__wnio.Wspolwlasciciele__wnio.WspolwlascicielNieruchomosci-bind"
name="SZ_wnio.TytulPrawnyUzytkowanejNieruchomosci_wnio.Wspolwlasnosc__wnio.Wspolwlasciciele__wnio.WspolwlascicielNieruchomosci"
nodeset="//wnio:TrescDokumentu/wnio:Zgloszenia/wnio:ZgloszenieZamiaruUmieszczeniaSzylduNaObiekcieBudowlanym/wnio:OswiadczenieOPosiadanymPrawieDoDysponowaniaNieruchomoscia/wnio:TytulPrawnyUzytkowanejNieruchomosci/wnio:Wspolwlasnosc/wnio:Wspolwlasciciele/wnio:WspolwlascicielNieruchomosci" />
type="xs:boolean"/>
</xforms:bind>
Related
Forgive the simple question, but how can I pass a value into a control via an Action.
What I'm trying to achieve is to display a message popup with two buttons, and depending on the button pressed, I then want to populate a control value:
<xf:action observer="Message1-control" event="DOMActivate">
<xf:label>Alert Button</xf:label>
<xf:message>You pressed the Message 1 button</xf:message>
<!-- Here is where we want to write the value back to a control -->
</xf:action>
I've tried all sorts of synyax, but I'm struggling to get it right
I make demo form for you https://demo.orbeon.com/demo/fr/orbeon/builder/edit/2e978a87be5ce4112d9b008dd481ae935040861c
I use xxf:show and xxf:dialog to show modal popup with two controls. In button in modal I use xf:setvalue to propagate value from input and xxf:hide to hide window.
<xh:html xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:array="http://www.w3.org/2005/xpath-functions/array"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:saxon="http://saxon.sf.net/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xf="http://www.w3.org/2002/xforms">
<xh:head>
<xh:title>Untitled Form</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true" xxf:analysis.calculate="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<grid-1>
<AgeOutput/>
<BtnShowDialog/>
<btnDialogBox/>
<textBoxDialog/>
</grid-1>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="grid-1-bind" ref="grid-1" name="grid-1">
<xf:bind id="AgeOutput-bind" name="AgeOutput" ref="AgeOutput" xxf:whitespace="trim"/>
<xf:bind id="BtnShowDialog-bind" ref="BtnShowDialog" name="BtnShowDialog"/>
<xf:bind id="textBoxDialog-bind" name="textBoxDialog" ref="textBoxDialog"
xxf:whitespace="trim"/>
<xf:bind id="btnDialogBox-bind" ref="btnDialogBox" name="btnDialogBox"/>
</xf:bind>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance id="fr-form-metadata" xxf:readonly="true" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>test</application-name>
<form-name>age_dialog</form-name>
<title xml:lang="en">Untitled Form</title>
<description xml:lang="en"/>
<created-with-version>2021.1.6.202211071741 PE</created-with-version>
<library-versions>
<orbeon>14</orbeon>
<app>2</app>
</library-versions>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments/>
</xf:instance>
<!-- All form resources -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<section-1>
<label>Untitled Section</label>
</section-1>
<AgeOutput>
<label/>
<hint/>
</AgeOutput>
<BtnShowDialog>
<label>Show dialog</label>
<hint/>
</BtnShowDialog>
<textBoxDialog>
<label>Age</label>
<hint/>
</textBoxDialog>
<btnDialogBox>
<label>Send</label>
<hint/>
</btnDialogBox>
</resource>
</resources>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-section" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid id="grid-1-grid" bind="grid-1-bind">
<fr:c y="1" x="1" w="6">
<xf:input id="AgeOutput-control" bind="AgeOutput-bind">
<xf:label ref="$form-resources/AgeOutput/label"/>
<xf:hint ref="$form-resources/AgeOutput/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</fr:c>
<fr:c y="1" x="7" w="6">
<xf:trigger id="BtnShowDialog-control" bind="BtnShowDialog-bind">
<xf:label ref="$form-resources/BtnShowDialog/label"/>
<xf:hint ref="$form-resources/BtnShowDialog/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xxf:show event="DOMActivate" dialog="my-dialog-id"/>
</xf:trigger>
</fr:c>
</fr:grid>
</fr:section>
<xxf:dialog id="my-dialog-id" appearance="full" level="modal" close="true" draggable="true"
visible="false">
<xf:label>Age confirm</xf:label>
<xf:input id="textBoxDialog-control" bind="textBoxDialog-bind">
<xf:label ref="$form-resources/textBoxDialog/label"/>
<xf:hint ref="$form-resources/textBoxDialog/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
<xf:trigger id="btnDialogBox-control" bind="btnDialogBox-bind">
<xf:label ref="$form-resources/btnDialogBox/label"/>
<xf:hint ref="$form-resources/btnDialogBox/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:action event="DOMActivate">
<!-- Operation to perform -->
<xf:setvalue ref="//AgeOutput" value="//textBoxDialog"/>
</xf:action>
<xxf:hide event="DOMActivate" dialog="my-dialog-id"/>
</xf:trigger>
</xxf:dialog>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
It needs to implement a mechanism that will count the number of repeated grids and send the value to the dedicated cell (named x).
If check box - First choice is unchecked, repeated grid is hidden and cell x must show "0".
If check box - First choice is checked, repeated grid become visible and cell x must show "1", and increase by 1 for each addition of repeated grid.
What expression I need to use in cell x?
If in your repeated grid you have a field named first-name, the expression count($first-name) used in a control outside of the repeated grid returns the number of rows in your repeated grid. Assuming your checkbox field is named checkbox, your expression would look like:
if ($checkbox/string() = 'true')
then count($first-name)
else 0
You can find the source of a test form that shows this in action below, and at runtime you get something like:
<xh:html xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:array="http://www.w3.org/2005/xpath-functions/array"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:saxon="http://saxon.sf.net/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xf="http://www.w3.org/2002/xforms">
<xh:head>
<xh:title>Counting the number of rows in a repeated grid</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true" xxf:analysis.calculate="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<grid-1>
<checkbox question-identifier="">true</checkbox>
<count question-identifier=""/>
</grid-1>
<grid-2>
<grid-2-iteration>
<first-name question-identifier=""/>
</grid-2-iteration>
</grid-2>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="grid-1-bind" ref="grid-1" name="grid-1">
<xf:bind id="count-bind" name="count" ref="count" xxf:whitespace="trim"
calculate="if ($checkbox/string() = 'true')
then count($first-name)
else 0"
readonly="false()"/>
<xf:bind id="checkbox-bind" ref="checkbox" name="checkbox" type="xf:boolean"/>
</xf:bind>
<xf:bind id="grid-2-bind" ref="grid-2" name="grid-2"
relevant="$checkbox/string() = 'true'">
<xf:bind id="grid-2-iteration-bind" ref="grid-2-iteration" name="grid-2-iteration">
<xf:bind id="first-name-bind" ref="first-name" name="first-name" xxf:whitespace="trim"/>
</xf:bind>
</xf:bind>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance id="fr-form-metadata" xxf:readonly="true" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>a</application-name>
<form-name>a</form-name>
<title xml:lang="en">Counting the number of rows in a repeated grid</title>
<description xml:lang="en"/>
<created-with-version>2019.1-SNAPSHOT PE</created-with-version>
<library-versions>
<orbeon>1</orbeon>
<app>2</app>
</library-versions>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments/>
</xf:instance>
<!-- All form resources -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<checkbox>
<label>Show repeated grid</label>
<hint/>
</checkbox>
<count>
<label>Count</label>
<hint/>
</count>
<first-name>
<label>First name</label>
<hint/>
</first-name>
<section-1>
<label>Untitled Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
<xf:instance xxf:readonly="true" id="grid-2-template" xxf:exclude-result-prefixes="#all">
<grid-2-iteration>
<first-name/>
</grid-2-iteration>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-section" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid id="grid-1-grid" bind="grid-1-bind">
<fr:c y="1" x="1" w="6">
<fr:checkbox-input id="checkbox-control" bind="checkbox-bind">
<xf:label ref="$form-resources/checkbox/label"/>
<xf:hint ref="$form-resources/checkbox/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:checkbox-input>
</fr:c>
<fr:c y="1" x="7" w="6">
<xf:input id="count-control" bind="count-bind">
<xf:label ref="$form-resources/count/label"/>
<xf:hint ref="$form-resources/count/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</fr:c>
</fr:grid>
<fr:grid id="grid-2-grid" bind="grid-2-bind" repeat="content" min="1"
template="instance('grid-2-template')"
apply-defaults="true"
fb:initial-iterations="first">
<fr:c x="1" y="1" w="6">
<xf:input id="first-name-control" bind="first-name-bind">
<xf:label ref="$form-resources/first-name/label"/>
<xf:hint ref="$form-resources/first-name/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</fr:c>
<fr:c x="7" y="1" w="6"/>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
I'm using Orbeon v2017.1 and I'm trying to create a service within a Section Template which is supposed to retrieve the label of the default country which should be preselected in an autocomplete field (country).
I want to preselect the country only if the user has not entered a value (or, when the form loads). It should support multiple languages.
If I trigger the action after "form loads" and after "the controls are ready", it calls my service but only for the library form. For all other forms which include this reusable section, the service is not called.
Is there some other way this could be achieved? Thanks in advance.
EDIT
Below is an example of an autocomplete field, service, and action which sets the control value
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude">
<xh:head>
<xh:title/>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<xf:instance id="all-countries"
src="http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso/ListOfCountryNamesByName/XML"/>
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<country-dynamic-autocomplete label=""/>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="country-dynamic-autocomplete-bind" ref="country-dynamic-autocomplete"
name="country-dynamic-autocomplete"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>insurance</application-name>
<form-name>test</form-name>
<title xml:lang="en"/>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<!-- Don't make readonly by default in case a service modifies the resources -->
<xf:instance id="fr-form-resources" xxf:readonly="false" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<country-dynamic-autocomplete>
<label>Countries Preselect Value</label>
<hint/>
</country-dynamic-autocomplete>
<section-1>
<label>Country Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
<xf:instance id="get-default-country-value-instance" class="fr-service"
xxf:exclude-result-prefixes="#all">
<body xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder"><params/></body>
</xf:instance>
<xf:submission id="get-default-country-value-submission" class="fr-service"
resource="http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso/CountryName/XML/debug?sCountryISOCode=DE"
method="get"
serialization="none"
mediatype="none"/>
<xf:action id="set-country-default-value-binding">
<xf:action event="DOMActivate" ev:observer="country-dynamic-autocomplete-control"
if="true()">
<xf:send submission="get-default-country-value-submission"/>
</xf:action>
<xf:action event="xforms-submit" ev:observer="get-default-country-value-submission">
<xf:var name="request-instance-name" value="'get-default-country-value-instance'"/>
<xf:action/>
</xf:action>
<xf:action event="xforms-submit-done" ev:observer="get-default-country-value-submission">
<xf:action class="fr-set-control-value-action">
<xf:var name="control-name" value="'country-dynamic-autocomplete'"/>
<xf:var name="control-value" value="/string"/>
</xf:action>
</xf:action>
</xf:action>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:autocomplete xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
id="country-dynamic-autocomplete-control"
labelref="#label"
max-results-displayed="300"
resource="http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso/ListOfCountryNamesByName/XML"
bind="country-dynamic-autocomplete-bind">
<xf:label ref="$form-resources/country-dynamic-autocomplete/label"/>
<xf:hint ref="$form-resources/country-dynamic-autocomplete/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="/ArrayOftCountryCodeAndName/tCountryCodeAndName">
<xf:label ref="sName"/>
<xf:value ref="sISOCode"/>
</xf:itemset>
</fr:autocomplete>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
EDIT 2 (new service):
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude">
<xh:head>
<xh:title/>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<xf:instance id="all-countries" src="http://api.worldbank.org/v2/countries/"/>
<!-- Main instance --> <xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<country-dynamic-autocomplete label=""/>
<control-3/>
</section-1>
</form>
</xf:instance>
<!-- Bindings --> <xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="country-dynamic-autocomplete-bind" ref="country-dynamic-autocomplete"
name="country-dynamic-autocomplete"/>
<xf:bind id="control-3-bind" ref="control-3" name="control-3" xxf:whitespace="trim"/>
</xf:bind>
</xf:bind>
<!-- Metadata --> <xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>insurance</application-name>
<form-name>test</form-name>
<title xml:lang="en"/>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments --> <xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources --> <!-- Don't make readonly by default in case a service modifies the resources --> <xf:instance id="fr-form-resources" xxf:readonly="false" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<country-dynamic-autocomplete>
<label>Countries Preselect Value</label>
<hint/>
</country-dynamic-autocomplete>
<control-3>
<label>XML</label>
<hint/>
</control-3>
<section-1>
<label>Country Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
<xf:instance id="get-default-country-value-instance" class="fr-service"
xxf:exclude-result-prefixes="#all">
<body xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder"><params/></body>
</xf:instance>
<xf:submission id="get-default-country-value-submission" class="fr-service"
resource="http://restcountries.eu/rest/v2/name/deutschland"
method="get"
serialization="none"
mediatype="none"/>
<xf:instance id="json-to-xml-instance" class="fr-service" xxf:exclude-result-prefixes="#all">
<body xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder"><params/></body>
</xf:instance>
<xf:submission id="json-to-xml-submission" class="fr-service"
resource="http://restcountries.eu/rest/v2/all"
method="get"
serialization="none"
mediatype="none"/>
<xf:action id="show-json-in-xml-binding">
<xf:action event="fr-run-form-load-action-after-controls" ev:observer="fr-form-model"
if="true()">
<xf:send submission="json-to-xml-submission"/>
</xf:action>
<xf:action event="xforms-submit" ev:observer="json-to-xml-submission">
<xf:var name="request-instance-name" value="'json-to-xml-instance'"/>
<xf:action/>
</xf:action>
<xf:action event="xforms-submit-done" ev:observer="json-to-xml-submission">
<xf:action class="fr-set-control-value-action">
<xf:var name="control-name" value="'control-3'"/>
<xf:var name="control-value" value="saxon:serialize(., 'xml')"/>
</xf:action>
</xf:action>
</xf:action>
<xf:action id="set-country-default-value-binding">
<xf:action event="DOMActivate" ev:observer="country-dynamic-autocomplete-control"
if="true()">
<xf:send submission="get-default-country-value-submission"/>
</xf:action>
<xf:action event="xforms-submit" ev:observer="get-default-country-value-submission">
<xf:var name="request-instance-name" value="'get-default-country-value-instance'"/>
<xf:action/>
</xf:action>
<xf:action event="xforms-submit-done" ev:observer="get-default-country-value-submission">
<xf:action class="fr-set-control-value-action">
<xf:var name="control-name" value="'country-dynamic-autocomplete'"/>
<xf:var name="control-value" value="saxon:serialize(., 'xml')"/>
</xf:action>
</xf:action>
</xf:action>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:autocomplete xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
id="country-dynamic-autocomplete-control"
labelref="#label"
max-results-displayed="300"
resource="http://restcountries.eu/rest/v2/all"
bind="country-dynamic-autocomplete-bind">
<xf:label ref="$form-resources/country-dynamic-autocomplete/label"/>
<xf:hint ref="$form-resources/country-dynamic-autocomplete/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="/_/name">
<xf:label ref="name"/>
<xf:value ref="alpha2Code"/>
</xf:itemset>
</fr:autocomplete>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<xf:input id="control-3-control" bind="control-3-bind">
<xf:label ref="$form-resources/control-3/label"/>
<xf:hint ref="$form-resources/control-3/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
I'm using XInclude to import several forms as tabs on a multi-tabbed container form (using fr:tabbable and fr:tab). I am importing the model, binds, resources and body of each sub-form.
One of the components on a tab is an XBL component containing an HTML img element pointing to a static png image file. The image is displayed ok when the sub-form is published and invoked on its own, but when imported on to the multi-tabbed form the image link is broken.
When inspecting the source, the path to the image in the /xbl folder has been modified to include the oxf:/ protocol.
In addition, there is logic on the xbl form control to make it non-relevant when the form is loaded and depends on a checkbox to make it relevant. When the logic is removed, the image is displayed.
I have done some more testing and confirm that the problem occurs when enabling non-relevant controls on a form which has been imported via xinclude.
Orbeon is also in persistence mode using the CRUD REST api to save and publish forms as text files.
Is there anything I can do to make sure the image path is initialised when it is non-relevant?
Many thanks,
Import.xhtml
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
<xh:head>
<xh:title>Import Test</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<xi:include href="oxf:/forms/Testing/FootMapTest/form/form.xhtml"
xpointer="xpath(//form/*)"/>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xi:include href="oxf:/forms/Testing/FootMapTest/form/form.xhtml"
xpointer="xpath(//xf:model/xf:bind[#id='fr-form-binds']/*)"/>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>Testing</application-name>
<form-name>ImportTest</form-name>
<title xml:lang="en">Import Test</title>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<xi:include href="oxf:/forms/Testing/FootMapTest/form/form.xhtml"
xpointer="xpath(//resources/resource[#xml:lang='en']/*)"/>
</resource>
</resources>
</xf:instance>
<!-- Utility instances for services -->
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xbl="http://www.w3.org/ns/xbl">
<fr:tabbable>
<fr:tab>
<fr:label>Tab 1</fr:label>
<xi:include href="oxf:/forms/Testing/FootMapTest/form/form.xhtml"
xpointer="xpath(//xh:body/fr:view/fr:body/*)"/>
</fr:tab>
</fr:tabbable>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
FootMapTest.xhtml
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
<xh:head>
<xh:title>FootMap Test</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<showFoot/>
<control-2/>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="control-2-bind" ref="control-2" name="control-2"
relevant="$showFoot=true()"/>
<xf:bind id="showFoot-bind" ref="showFoot" name="showFoot" type="xf:boolean"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>Testing</application-name>
<form-name>FootMapTest</form-name>
<title xml:lang="en">FootMap Test</title>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<showFoot>
<label>Show Foot?</label>
<hint/>
</showFoot>
<control-2>
<label/>
<hint/>
</control-2>
<section-1>
<label>Untitled Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
<!-- Utility instances for services -->
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xbl="http://www.w3.org/ns/xbl">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:yesno-input xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="showFoot-control"
bind="showFoot-bind">
<xf:label ref="$form-resources/showFoot/label"/>
<xf:hint ref="$form-resources/showFoot/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:yesno-input>
</xh:td>
<xh:td>
<nhs:footmap xmlns:nhs="http://www.wales.nhs.uk/"
xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
side="left"
siteselect=""
missingtoes=""
testorder=""
id="control-2-control"
bind="control-2-bind">
<xf:label ref="$form-resources/control-2/label"/>
<xf:hint ref="$form-resources/control-2/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</nhs:footmap>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
footmap.xbl
<xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:nhs="http://www.wales.nhs.uk/">
<xbl:script src="/xbl/nhs/footmap/footmap.js"/>
<xbl:binding id="nhs-footmap" element="nhs|footmap"
xxf:external-events="nhs-footmap-updated nhs-footmap-refresh"
xxbl:mode="lhha binding value extenal-value focus"
xxbl:container="span">
<metadata xmlns="http://orbeon.org/oxf/xml/form-builder">
<display-name lang="en">Foot Map</display-name>
<icon lang="en">
<small-icon>/apps/fr/style/images/silk/image.png</small-icon>
<large-icon>/apps/fr/style/images/silk/image.png</large-icon>
</icon>
<templates>
<view>
<nhs:footmap side="left" siteselect="" missingtoes="" testorder="">
<xf:label ref=""/>
<xf:hint ref=""/>
<xf:help ref=""/>
<xf:alert ref=""/>
</nhs:footmap>
</view>
</templates>
<control-details>
<xf:select1 ref="#side">
<xf:label>Side:</xf:label>
<xf:hint>Which foot?</xf:hint>
<xf:item>
<xf:label>Left</xf:label>
<xf:value>left</xf:value>
</xf:item>
<xf:item>
<xf:label>Right</xf:label>
<xf:value>right</xf:value>
</xf:item>
</xf:select1>
<xf:select ref="#siteselect" appearance="full">
<xf:label>Sites:</xf:label>
<xf:hint>Which sites?</xf:hint>
<xf:item selected="true">
<xf:label>Big Toe (1):</xf:label>
<xf:value>1</xf:value>
</xf:item>
<xf:item selected="true">
<xf:label>Middle Toe (3):</xf:label>
<xf:value>3</xf:value>
</xf:item>
<xf:item selected="true">
<xf:label>Little Toe (5):</xf:label>
<xf:value>5</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Plantar</xf:label>
<xf:value>6</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Medial</xf:label>
<xf:value>7</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Lateral</xf:label>
<xf:value>8</xf:value>
</xf:item>
</xf:select>
<xf:select ref="#missingtoes" appearance="full">
<xf:label>Missing Toes:</xf:label>
<xf:hint>Which toes are missing?</xf:hint>
<xf:item selected="false">
<xf:label>Big Toe (1):</xf:label>
<xf:value>1</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Index Toe (2):</xf:label>
<xf:value>2</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Middle Toe (3):</xf:label>
<xf:value>3</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Fourth Toe (4):</xf:label>
<xf:value>4</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Little Toe (5):</xf:label>
<xf:value>5</xf:value>
</xf:item>
</xf:select>
<xf:input ref="#testorder">
<xf:label>Test Order (json):</xf:label>
<xf:hint>What order should sites be tested?</xf:hint>
</xf:input>
</control-details>
</metadata>
<xbl:resources>
<xbl:style src="/xbl/nhs/footmap/footmap.css"/>
</xbl:resources>
<xbl:handlers>
<xbl:handler event="nhs-footmap-updated" phase="target">
<!-- <xf:message level="modal">
<xf:output value="event('states')" />
</xf:message> -->
<xf:var name="jsonstates" select="event('states')" />
<xf:setvalue ref="xxf:binding('nhs-footmap')" value="$jsonstates" />
</xbl:handler>
<xbl:handler type="javascript" ev:event="xforms-enabled" phase="target">
ORBEON.xforms.XBL.instanceForControl(this).updateAreas();
</xbl:handler>
<xbl:handler type="javascript" ev:event="xforms-disabled" phase="target">
//ORBEON.xforms.XBL.instanceForControl(this).hide();
</xbl:handler>
<!-- <xbl:handler type="javascript" event="nhs-footmap-refresh" phase="target">
ORBEON.xforms.XBL.instanceForControl(this).updateAreas();
</xbl:handler> -->
<xbl:handler type="javascript" event="xforms-value-changed" phase="target">
ORBEON.xforms.XBL.instanceForControl(this).updateAreas();
</xbl:handler>
</xbl:handlers>
<xbl:template xxbl:transform="oxf:unsafe-xslt">
<xsl:transform version="2.0">
<xsl:import href="oxf:/oxf/xslt/utils/xbl.xsl"/>
<xsl:template match="/*">
<xf:group class="nhs-footmap-container">
<xf:model id="footmap-model">
<xf:instance id="areastates">
<json type="object">
<data/>
</json>
</xf:instance>
<xf:instance id="local">
<model>
<side/>
<areas/>
</model>
</xf:instance>
</xf:model>
<!-- Variable pointing to external single-node binding -->
<xf:var name="binding" value="xxf:binding('nhs-footmap')"/>
<xf:var name="binding-context" value="xxf:binding-context('nhs-footmap')"/>
<xf:var name="local" value="instance('local')"/>
<xf:var name="view" value="exf:readonly($binding) and property('xxf:readonly-appearance') = 'static'"/>
<xsl:copy-of select="xxbl:parameter(., 'side')"/>
<xf:var name="leftFoot" value="$side = 'left'" />
<xf:var name="rightFoot" value="$side = 'right'" />
<xf:setvalue ref="instance('local')/side" value="{{$side}}" />
<xf:var name="requestPath" select="xxf:get-request-path()" />
<xsl:copy-of select="xxbl:parameter(., 'siteselect')"/>
<xf:var name="toe1" value="tokenize($siteselect, '\s+') = '1'" />
<xf:var name="toe3" value="tokenize($siteselect, '\s+') = '3'" />
<xf:var name="toe5" value="tokenize($siteselect, '\s+') = '5'" />
<xf:var name="plantar" value="tokenize($siteselect, '\s+') = '6'" />
<xf:var name="medial" value="tokenize($siteselect, '\s+') = '7'" />
<xf:var name="lateral" value="tokenize($siteselect, '\s+') = '8'" />
<xsl:copy-of select="xxbl:parameter(., 'missingtoes')"/>
<xf:var name="missing-toe1" value="tokenize($missingtoes, '\s+') = '1'" />
<xf:var name="missing-toe2" value="tokenize($missingtoes, '\s+') = '2'" />
<xf:var name="missing-toe3" value="tokenize($missingtoes, '\s+') = '3'" />
<xf:var name="missing-toe4" value="tokenize($missingtoes, '\s+') = '4'" />
<xf:var name="missing-toe5" value="tokenize($missingtoes, '\s+') = '5'" />
<xsl:copy-of select="xxbl:parameter(., 'testorder')"/>
<xf:var name="notestorder" value="string-length($testorder)=0" />
<!--<xf:group id="component-group" ref="$binding[not($view)]">-->
<xf:group id="component-group" ref="$binding">
<xf:input ref="$binding" id="nhs-footmap-states" class="nhs-footmap-states" />
<xh:div class="xbl-nhs-footmap-imagemap-div nhs-footmap-imgsize">
<xh:img class="nhs-footmap-footimage" src="/xbl/nhs/footmap/img/{{$side}}foot.png" usemap="#foot-imagemap-{{$side}}" />
<xf:group ref=".[$toe1 and not($missing-toe1)]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe1 nhs-footmap-site"> <xh:span class="badge">N</xh:span></xh:a>
</xf:group>
<xf:group ref=".[$missing-toe1]">
<xh:a href="#" data-value="-" class="nhs-footmap-{{$side}}-toe1 nhs-footmap-site toe-missing"> <xh:span class="badge"><xh:i class="icon-minus icon-white"/></xh:span></xh:a>
</xf:group>
<xf:group ref=".[$toe3 and not($missing-toe3)]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe3 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[$missing-toe3]">
<xh:a href="#" data-value="-" class="nhs-footmap-{{$side}}-toe3 nhs-footmap-site toe-missing"> <xh:span class="badge"><xh:i class="icon-minus icon-white"/></xh:span></xh:a>
</xf:group>
<xf:group ref=".[$toe5 and not($missing-toe5)]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe5 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[$missing-toe5]">
<xh:a href="#" data-value="-" class="nhs-footmap-{{$side}}-toe5 nhs-footmap-site toe-missing"> <xh:span class="badge"><xh:i class="icon-minus icon-white"/></xh:span></xh:a>
</xf:group>
<xf:group ref=".[$plantar]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe6 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[$medial]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe7 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[$lateral]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe8 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[not($notestorder)]">
<xh:span class="nhs-footmap-{{$side}}-testorder1 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder3 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder5 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder6 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder7 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder8 nhs-footmap-testorder badge" />
</xf:group>
</xh:div>
<!--<xf:trigger id="resetButton">
<xf:label>Reset</xf:label>
<xf:action type="javascript" event="DOMActivate">
ORBEON.xforms.XBL.instanceForControl(this).reset();
</xf:action>
</xf:trigger>-->
<!--<xf:trigger id="absentButton">
<xf:label>Absent</xf:label>
<xf:action type="javascript" event="DOMActivate">
ORBEON.xforms.XBL.instanceForControl(this).absent();
</xf:action>
</xf:trigger>-->
<!-- Properties -->
</xf:group>
<!-- <xf:group ref="$binding[$view]"/> -->
</xf:group>
</xsl:template>
</xsl:transform>
</xbl:template>
</xbl:binding>
</xbl:xbl>
How can I create a dynamic link with a value as part of the url in a xh:a link in orbeon?
<x131573079 type="input"/>
<xh:a target="_blank" href="concat('http://www.someurl.nl/new?code=', $x131573079)">linkwithcode</xh:a></xh:div>
I have created a minimum set too display the problem. The
I created a minimum set the display the issue. The {concat()} does not work in this case...
<?xml version="1.0" encoding="UTF-8"?>
<xh:head xml:lang="nl">
<xh:title>hyperlink</xh:title>
<xf:model id="fr-form-model" xxf:revisit-handling="reload" xxf:noscript-support="true">
<xf:instance id="fr-form-instance">
<form group-name="patrickgroep" form-name="hyperlink" form-title="">
<formname>hyperlink</formname>
<formtitle/>
<groupname>patrickgroep</groupname>
<tab_nav>
<tab_1 idx="1" name="x124675808" visibility="opened">true()</tab_1>
</tab_nav>
<x124675808 type="tab" tabidx="1">
<x124412365 type="block" layout="vertical" in_overview="true">
<x131573079 type="input" prefill="nu2"/>
<x177054053 type="output"/>
</x124412365>
<error_count/>
</x124675808>
<x124675808nav-button/>
</form>
</xf:instance>
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="formname-bind" ref="formname" name="formname"/>
<xf:bind id="formtitle-bind" ref="formtitle" name="formtitle"/>
<xf:bind id="groupname-bind" ref="groupname" name="groupname"/>
<xf:bind id="x124675808-bind" ref="x124675808" relevant="true()">
<xf:bind id="x124412365-bind" ref="x124412365" relevant="true()">
<xf:bind id="x131573079-bind" ref="x131573079" name="x131573079"
required="false()" readonly="false()" xxf:default="nu"/>
<xf:bind id="x177054053-bind" ref="x177054053"
calculate="if (xxf:evaluate-bind-property('x124412365-bind', 'relevant')) then (concat('http://somesite.com/page?code=',$x131573079)) else ''"
/>
</xf:bind>
</xf:bind>
</xf:bind>
<xf:instance id="fr-form-resources" xxf:cache="true">
<resources>
<resource xml:lang="nl">
<x124675808>
<label>MyTab</label>
</x124675808>
<x124412365>
<title/>
</x124412365>
<x131573079>
<label>vraag</label>
</x131573079>
<x177054053>
<label>whatever</label>
</x177054053>
</resource>
</resources>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<xh:div id="variables"/>
<fr:view>
<xf:label ref="instance('fr-form-metadata')/title"/>
<fr:body>
<xf:group xxf:update="full" id="x124675808-section" bind="x124675808-bind"
class="tab-{if(xxf:instance('fr-form-instance')/tab_nav/tab_1='true()') then 'visible' else 'hidden'}">
<xh:h2 class="section-header">
<xf:output id="x124675808-title-text" mediatype="text/html"
ref="$form-resources/x124675808/label"/>
</xh:h2>
<xf:group id="x124675808-group">
<xf:group id="x124412365" bind="x124412365-bind"
class="default-block block-layout-vertical">
<xh:div id="x124412365-content">
<xh:div id="x131573079-content-item" class="block-layout-vertical">
<xf:input bind="x131573079-bind" id="x131573079-control">
<xf:label>
<xf:output id="x131573079-label-outputtext"
mediatype="text/html"
ref="$form-resources/x131573079/label"/>
</xf:label>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:div>
<xh:div id="x177054053-content-item" class="block-layout-vertical">
<xf:output bind="x177054053-bind" id="x177054053-control"
mediatype="text/html"/>
</xh:div>
<xh:div>
<xh:a target="_target"
href="{concat('http://somesite.com/page?code=',$x131573079)}"
>somesite.com</xh:a>
</xh:div>
</xh:div>
</xf:group>
</xf:group>
</xf:group>
</fr:body>
</fr:view>
</xh:body>
It's very simple, you just need to add {} in the attribute, and what is inside the curly brackets will be evaluated as an XPath expression:
<xh:a target="_blank"
href="{concat('http://www.someurl.nl/new?code=', $x131573079)}">
linkwithcode
</xh:a>
It seems I have fixed the issue with the following post: Orbeon Form Builder - hyperlink with dynamic url?
using this:
<xh:a target="_target" id="123"
href="http://www.nu.nl/code={x131573079}"
>somesite.com</xh:a>