Hi All,
I am trying to create a dynamic drop-down (like the control) that will copy the node structure rather than just the value of the control. For example I have the following XML <xf:instance id="itemset"> <test> <entry> <name>John</name> <id>1</id> <type>person</type> </entry> <entry> <name>Test</name> <id>2</id> <type>N/A</type> </entry> <entry> <name>Fed</name> <id>3</id> <type>Food</type> </entry> </test> </xf:instance> I populate an item set with the following <xf:itemset ref="entry"> <xf:label ref="name"/> <xf:value ref="."/> </xf:itemset> I create a binding to my XBL with the following <xf:var name="binding" value="xxf:binding('workflow-rest-search')"/> I then use the xf:select1 (Like in the dynamic drop-down) <xf:select1 ref="$binding" id="select1" xbl:attr="xxf:encrypt-item-values"> <xf:item> <xf:label/> <xf:value/> </xf:item> <xf:choices context="instance()"> <xbl:content includes=":root > xf|itemset, :root > xf|item, :root > xf|choices" xxbl:scope="inner"/> </xf:choices> </xf:select1> The result of this is a dropdown with all the options, however the when one is selected, it inserts the value of the choice (eg. Fed -> Fed 3 Food) but what I am looking for is the whole structure to be used. <entry> <name>Fed</name> <id>3</id> <type>Food</type> </entry> Is there a way to achieve this? I have tried the following, <xf:itemset ref="entry"> <xf:label ref="name"/> <xf:copy ref="."/> </xf:itemset> However when I try too use xf:copy I get the following error Unknown control: xf:copy Any ideas around this? Thanks for your time, Joel. -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1568604663372-0.post%40n4.nabble.com. |
Administrator
|
Hi Joel,
I think the issue is that at this point Orbeon Forms' implementation of XForms does not support `<xf:copy>` inside an `<xf:itemset>`. Would you be able to use a simple value as a workaround, or store the value somewhere and upon `xforms-select` run an `xf:insert` that inserts the subtree? https://www.w3.org/community/xformsusers/wiki/XForms_2.0#ui-selection-commonelems-copy ‑Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1568667923517-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex!
Thanks for your reply! So taking your advice.. I now am returning the index of the selected "choice" from the select1, and inserting that into an instance with the following. <xf:instance id="choice"><index/></xf:instance> <xf:bind ref="instance('choice')" name="choice" id="choice-bind"/> <xf:var name="choice" value="bind('choice-bind')"/> <xf:select1 ref="$choice" id="select1" xbl:attr="xxf:encrypt-item-values"> <xf:item> <xf:label/> <xf:value/> </xf:item> <xf:choices context="instance()"> <xbl:content includes=":root > xf|itemset, :root > xf|item, :root > xf|choices" xxbl:scope="inner"/> </xf:choices> </xf:select1> Now I am having an issue with getting the value at the index! say I have the following tree (returned from my submission, converted from json) <json type="object"> <size type="number">10</size> <total type="number">2</total> <results type="array"> <_ type="object"> <patientNs>IHN</patientNs> <city>Los Angeles</city> <state /> <masterPatientIdentifier>IHN:123401</masterPatientIdentifier> <dob>19540701</dob> <postcode>5001</postcode> <addr2 /> <addr1>1 Neverland Ranch</addr1> <sex>I</sex> <patientUrno /> <lastName>Mo</lastName> <firstName>Jo</firstName> </_> <_ type="object"> <patientNs>IHN</patientNs> <city>Los Angeles</city> <state /> <masterPatientIdentifier>IHN:000001</masterPatientIdentifier> <dob>19290621</dob> <postcode>5001</postcode> <addr2 /> <addr1>1 Neverland Ranch</addr1> <sex>I</sex> <patientUrno /> <lastName>Mo</lastName> <firstName>Jo</firstName> </_> </results> <order>asc</order> <sort>id</sort> <start type="number">0</start> </json> Now in this list I am populating a select1 with the itemset of <xf:itemset ref="results/_"> <xf:label ref="concat('firstName' , ', ' , 'lastName'"/> <xf:value ref="count(preceding-sibling::*[name() = name(current())])"/> </xf:itemset> This now gives me the index of my selection in the instance choice (as declared above) Now I have my action with the observer set on the get-itemset submission.. <xf:action event="xforms-submit-done" observer="get-itemset" ref="instance('itemset')"> <xf:setvalue ref="$binding" value="???"/> </xf:action> I have tried getting the xpath with the following <xf:var name="itemset-exp" xxbl:attr="xf:itemset/@ref" xxbl:scope="outer"/> <xf:var name="itemset-exp-avt" xxbl:attr="xf:itemset/@ref" xxbl:scope="outer"/> <xf:var name="itemset-exp"> <xxf:value value="xxf:evaluate-avt($itemset-exp-avt)" xxbl:scope="outer"/> </xf:var> I am just not sure how to get the xpath from the items set and apply it. Any ideas? Any Questions about my explanation let me know! I have been trying to figure this out all day! Argh! Also on a side note, is there a better way to format code for posting on the fourms? Cheers, and thanks again for your time... Joel. -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1568708634523-0.post%40n4.nabble.com. |
Administrator
|
Hi Joel,
Joel Oates wrote > Now I have my action with the observer set on the get-itemset submission.. What does the `get-itemset` submission do? And why do you need to set the value of the node the component is bound to when the submission returns? Joel Oates wrote > <xf:var name="itemset-exp" xxbl:attr="xf:itemset/@ref" > xxbl:scope="outer"/> > > <xf:var name="itemset-exp-avt" xxbl:attr="xf:itemset/@ref" > xxbl:scope="outer"/> > > <xf:var name="itemset-exp"> > > > <xxf:value value="xxf:evaluate-avt($itemset-exp-avt)" > xxbl:scope="outer"/> > > </xf:var> > Is the itemset specified by the user of your XBL component? How is your component used? Also, could you attach the entire source of the component? And what is the component doing, at a high level? For including source, we're planning to move to Discourse after the 2019.1 release, which will make it much better. In the meantime, what you did seems to work. And if it doesn't, you can also attach files with the source. ‑Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1568760022192-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
Here is the entire component,This is based off the dynamic-dropdown-select1 XBL, I am trying to modify it to insert the selected itemset tree (All the XML rather than just the values) into the xbl-binding. <?xml version="1.0" encoding="UTF-8"?> <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:exf="http://www.exforms.org/exf/1-0" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:fb="http://orbeon.org/oxf/xml/form-builder" xmlns:saxon="http://saxon.sf.net/" xmlns:workflow="http://www.infomedix.com.au/workflow" 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"> <fb:metadata> <fb:display-name lang="en">CPF Experimental Controls</fb:display-name> </fb:metadata> <xbl:binding id="workflow-rest-search" element="workflow|rest-search" xxbl:mode="lhha binding"> <metadata xmlns="http://orbeon.org/oxf/xml/form-builder" > <display-name lang="en">Rest Search</display-name> <icon lang="en"> </icon> <template> <workflow:rest-search ref="" resource=""> <xf:label ref="" /> <xf:hint ref="" /> <xf:help ref="" /> <xf:alert ref="" /> <xf:itemset ref="item"> <xf:label ref="label"/> <xf:value ref="value"/> </xf:itemset> </workflow:rest-search> </template> <control-details> <xf:model> <xf:bind ref="@resource"/> <xf:bind ref="xf:itemset"> <xf:bind ref="@ref | xf:label/@ref | xf:value/@ref" type="xxf:xpath2" required="true()"/> </xf:bind> </xf:model> <fr:grid> <xh:tr> <xh:td colspan="2"> <xf:input ref="@resource"> <xf:label ref="xxf:r('dialog-http-services.resource.label', '|fr-form-resources|')"/> <xf:hint ref="xxf:r('dialog-http-services.resource.hint', '|fr-form-resources|')"/> </xf:input> </xh:td> </xh:tr> <xh:tr> <xh:td colspan="2"> <xf:input ref="xf:itemset/@ref"> <xf:label ref="xxf:r('dialog-actions.items.label', '|fr-form-resources|')"/> <xf:hint ref="xxf:r('dialog-actions.items.hint', '|fr-form-resources|')"/> </xf:input> </xh:td> </xh:tr> <xh:tr> <xh:td> <xf:input ref="xf:itemset/xf:label/@ref"> <xf:label ref="xxf:r('dialog-actions.item-label.label', '|fr-form-resources|')"/> <xf:hint ref="xxf:r('dialog-actions.item-label.hint', '|fr-form-resources|')"/> </xf:input> </xh:td> <xh:td> <xf:input ref="xf:itemset/xf:value/@ref"> <xf:label ref="xxf:r('dialog-actions.item-value.label', '|fr-form-resources|')"/> <xf:hint ref="xxf:r('dialog-actions.item-value.hint', '|fr-form-resources|')"/> </xf:input> </xh:td> </xh:tr> </fr:grid> </control-details> </metadata> <xbl:resources> <xbl:style src="" /> </xbl:resources> <xbl:implementation> <xf:model id="xbl-model"> <xf:instance id="itemset"><dummy/></xf:instance> <xf:instance id="choice"><index/></xf:instance> <xf:instance id="submission-ran"><count>0</count></xf:instance> <xf:submission id="get-itemset" method="get" resource="{event('resource')}" replace="instance" serialization="none"> <xf:setvalue ev:event="xforms-submit-done" ref="instance('submission-ran')" value=". + 1"/> <xf:action ev:event="xforms-submit-error"> <xf:insert ref="instance('itemset')" origin="xf:element('dummy')"/> </xf:action> </xf:submission> <xf:bind ref="instance('choice')" name="choice" id="choice-bind"/> <xf:bind ref="xf:itemset" name="itemset" id="itemset-bind"/> </xf:model> </xbl:implementation> <xbl:template> <xf:var name="binding" value="xxf:binding('workflow-rest-search')"/> <xf:var name="choice" value="bind('choice-bind')"/> <xf:var name="resource-avt" xbl:attr="xbl:text=resource" xxbl:scope="outer"/> <xf:var name="resource"> <xxf:value value="xxf:evaluate-avt($resource-avt)" xxbl:scope="outer"/> <xf:action ev:event="xforms-enabled xforms-value-changed"> <xf:send if="xxf:non-blank($resource)" submission="get-itemset"> <xf:property name="resource" value="$resource"/> </xf:send> </xf:action> </xf:var> <xf:select1 ref="$choice" id="select1" xbl:attr="xxf:encrypt-item-values" > <xf:item> <xf:label/> <xf:value/> </xf:item> <xf:choices context="instance()"> <xbl:content includes=":root > xf|itemset, :root > xf|item, :root > xf|choices" xxbl:scope="inner"/> </xf:choices> </xf:select1> <xf:var name="itemset-exp-avt" xxbl:attr="xf:itemset/@ref" xxbl:scope="outer"/> <xf:var name="itemset-exp"> <xxf:value value="xxf:evaluate-avt($itemset-exp-avt)" xxbl:scope="outer"/> </xf:var> <xf:var name="ree-avt" xbl:attr="xbl:text=resource" xxbl:scope="outer"/> <xf:var name="ree"> <xxf:value value="xxf:evaluate-avt($ree-avt)" xxbl:scope="outer"/> </xf:var> <xf:action event="xforms-submit-done" observer="get-itemset" ref="instance('itemset')"> <xf:message ref="results/_"> </xf:message> <xf:message ref="."> </xf:message> <xf:message ref="$ree"> </xf:message> </xf:action> <xf:action event="xforms-value-changed" observer="select1"> <xf:message ref="$choice"/> </xf:action> <xf:var name="submission-ran" value="instance('submission-ran')/string()"> <xf:action ev:event="xforms-value-changed"> <xf:var name="new-values" value="xxf:itemset('select1', 'xml', false())//value/string()"/> <xf:setvalue if="not($binding = ($new-values, ''))" ref="$binding"/> <xf:insert context="$binding" if="empty(@itemset-empty)" origin="xf:attribute('itemset-empty')"/> <xf:setvalue ref="$binding/@itemset-empty" value="count($new-values) = 1"/> </xf:action> </xf:var> </xbl:template> </xbl:binding> </xbl:xbl> Thanks for the quick reply Cheers, Joel. -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1568762883219-0.post%40n4.nabble.com. |
Administrator
|
Hi Joel,
Thank you for the source of the XBL component. I now understand how the `xf:itemset` is specified by form authors in the Control Settings dialog. This component looks awfully similar to the Dynamic Data Dropdown (which, BTW, is improved in 2019.1 and can also behave more like an autocomplete control). Is there something that you're aiming for that isn't done already by the Dynamic Data Dropdown? Or, to rephrase that question, what is it that you are trying to do in that component, at a high level? ‑Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1568848196296-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
What I am trying to complete at a high level is a "patient" object search. So the idea is what I have a form witch a few feilds (Patient Name(first/last) an ID , etc etc~. Then with this information I want to make a request to our system which will return a list of patients that match the search criteria, with this list of patients returned I want to be able to select (from a list) which patient object that I wish to use... I made a little screen mock up in my design of what I want to achieve. Where the the component I want to "Implement" is the "Search" in this picture, and the table is the popup. <http://discuss.orbeon.com/file/t375722/1568290678127.png> Now I am going to need to do searches like this in many different places, so I wanted something that I could use in all of those places. Is something like this achievable with the new and Improved Dynamic Data Dropdown? Thanks for your reply. Joel -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1568853104914-0.post%40n4.nabble.com. |
Administrator
|
Hi Joel,
Just a couple of quick questions: do you want the component to show the list of possible results in a table (as in your mockup), or is a dropdown OK? And would you like the search fields (patient first, last name…) to be part of the component, or would they be part of the form, and their value fed to the component? ‑Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1568875024775-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
Alessandro Vernet wrote > do you want the component to show the list > of possible results in a table (as in your mockup), or is a dropdown OK? A table of results is my end goal (I was using the select1 for now and thinking about modifying to appearance later) Alessandro Vernet wrote > would you like the search fields (patient first, last name…) to be part of > the component, or would they be part of the form, and their value fed to > the > component? The idea at the moment is just to use those fields as apart of the Resource passed into the control. So I would like them to be fed into to component. Cheers, Joel. -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1568875799168-0.post%40n4.nabble.com. |
Administrator
|
Hi Joel,
> A table of results is my end goal (I was using the select1 for now and > thinking about modifying to appearance later) If at all possible, I'd recommend you use a Dynamic Data Dropdown for now, instead of creating your own component. Then, when you upgrade to 2019.1, you'll be able to mark it as "with search", and it will act more like an autocomplete, letting user search through a larger set of values. Would something along those lines be enough for your use case? ‑Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1569018736822-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
This post was updated on .
Hi Alex,
I looked into the stuff that you mentioned with the new select1 and wasn't to certain that it would do what I wanted, So I took another approach. I instead made a new repeat inside a table to populate the result from my submission, and use added a trigger to the end which I can use to select the nodeset. Code Sample: https://pastebin.com/aTwPESLu (HTML Tags Screwed up in the post) What I end up with is the following, <http://discuss.orbeon.com/file/t375722/Search-Table-Test.png> I use all this in a dialogue, which i just insert the selected result back into the main "patient" instance. Cheers, Joel. |
Administrator
|
Very good Joel, I'm glad you got this table to show, and indeed seems better
for your use case than the dropdown with search I was referring to. ‑Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1569437019645-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |