This post was updated on .
Hello,
I have a form with a "Databound-select" component which takes its values and labels from an external xml file. When I send the metadata to an external webservice, I don't see all possible labels and values? There is the configuration for this component : items : xxf:instance('fr-clubs-data')/sport name : name[@lang = xxf:lang()] value : @id Thank you for your help |
Administrator
|
Hi,
You'll need to tell us more about what you're doing for us to be able to help. Are you talking about the fr:databound-select1, called Dynamic Data Dropdown in Form Builder, or something else? Are you using Form Builder? What version are you on? What is the metadata you're talking about? Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi, thank you for your reply. Yes i'm talking aboug the fr:databound-select1 component, called Dynamic Data Dropdown in Form Builder and I'm using the Form Builder. I'm using the version 4.9.0.201505052329 CE. I attached you three files :
clubs.xml is the xml containing data populated to the databound-select1 component, 649f558a3871a8eb210302ee2d4f2aa3e4d1f68c.xml is the form sended by Orbeon with the following command : then send( uri = "http://localhost:9080/eDMS/eFormsPersistenceLayer/storeXml?dossierId={xxf:get-request-parameter('dossierId')}&dataType=data", parameters = "app form document form-version language", content = "metadata", method = "PUT" ) And formDefinition.xhtml is the form definition. You can see that for component like select, the items are filled in the 649f558a3871a8eb210302ee2d4f2aa3e4d1f68c.xml but nothing for component like databound-select1. Thank you. clubs.xml 649f558a3871a8eb210302ee2d4f2aa3e4d1f68c.xml formDefinition.xhtml |
Administrator
|
In reply to this post by vbr
I think that this is not supported yet, because the fr:databound-select1 doesn't expose it's itemset "natively". We have an RFE for this:
https://github.com/orbeon/orbeon-forms/issues/768 -Erik |
OK. Thank you for your answer. Do you know which class or xbl I have to patch to support it?
|
Administrator
|
Unfortunately, implementing support for itemsets in XBL would require quite a bit of knowledge of the XForms engine internals.
If you need the itemset to be send with send(content = "metadata"), I'd suggest you use a regular dropdown control, and fill its itemset with a service and an action. It is a little bit more work to do for the form author, as you'll need to define that service and action in Form Builder, but then send(content = "metadata") should be able to send the itemset sent along just fine. You'll let us know of this works for you! Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi, could you please give me the file to patch to see if it's difficult to implement? Do you think that it will be implemented soon?
Thank you fo your tip, I will try it but are services available in the CE? An other question, is it possible to serialize selected label instead of value? For example, if I have a list like this : <list> <itemset> <item> <value>val1</value>< <label>My value 1</label>< </item> <item> <value>val2</value> <label>My value 2</label> </item> </itemset> </list> And the user select "My value 1" in the list, is it possible to serialize "My value 1" instead of val1? Thank you! |
Administrator
|
Not to discourage you, and we are happy if you want to get into the source, but there would be probably many files to change and I would stay this is going to be difficult to implement.
Services from Form Builder are only available in PE. If you serialize metadata, the itemset is available. See in this example: https://gist.github.com/orbeon/3684806b0a30a9a5ace9 But if you just serialize as XML, only the item value, not the item label, is serialized. -Erik |
Ok, so the Alessandro's tip won't work because I'm using the CE.
Do you think that it will be implemented soon? Another idea to solve my problem? Thank you |
Administrator
|
I can't think of another way to do this with the CE. And we have no immediate plans to implement issue 768. So I'm afraid that at this point, if you really need to itemset to be sent, it seems to me that using the PE instead the CE is the only option I can think of.
Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Thank you for your help! Do you know if is it possible to define action that doesn't use WebServices?
I ask this question because the my data are contained in a xml file stored in a directory in Orbeon and I reference it like this : <xf:instance id="fr-clubs-data" src="oxf:/egov/clubs.xml"/> And in my component I'm referencing it like this : xxf:instance('fr-clubs-data')/sport Thanks |
Hi I tried to use Actions + WebServices and it works! Unfortunately I don't find how consume request body from xpl webservices. Do you have an idea?
This is my xpl : <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://saxon.sf.net/" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://orbeon.org/oxf/xml/xmldb" xmlns:f="http://www.orbeon.com/oxf/function"> <p:param name="data" type="output"/> <p:processor name="oxf:xslt"> <p:input name="data" href="clubs.xml"/> <p:input name="config"> <response xsl:version="2.0"> <xsl:for-each select="//sport/name"> <row> <value><xsl:value-of select="../@id"/></value> <lang><xsl:value-of select="@lang"/></lang> <label><xsl:value-of select="."/></label> </row> </xsl:for-each> </response> </p:input> <p:output name="data" ref="data"/> </p:processor> </p:config> Thank you! |
Administrator
|
Hi,
So this XPL is transforming your clubs.xml in a <row><value/><lang/><label/></row> format, which I assume you're consuming from a service+action you defined in Form Builder. But what do you mean by consume request body? Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
I want to make an another webservice that returns the list of
clubs name for a given sport id but I don't know how to send the sport id parameter to my xpl webservice and how can I retrieve this parameter in the xpl webservice to make an xpath query. In the form builder I see that I can set a request body that will be send to the xpl webservice but I don't know how to read it in the xpl webservice? Thank you for your help :-) |
Administrator
|
Got it; it's very simple: add a <p:param name="instance" type="input"/> at the top of your XPL, and that "instance" input will be the document submitted to the service.
Then, you can feed that to XSLT adding an input <p:input name="instance" href="#instance"/>, and in XSLT access the document in XPath with doc('input:instance'). Note that doc() returns the document node, so if the root element is <root>, you'll write doc('input:instance')/root/something. Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi, thank you for your help. I tried what you suggested but I can't retrieve my parameter...
Here's my xpl : <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://saxon.sf.net/" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://orbeon.org/oxf/xml/xmldb" xmlns:f="http://www.orbeon.com/oxf/function"> <p:param name="instance" type="input"/> <p:param name="data" type="output"/> <p:processor name="oxf:xslt"> <p:input name="instance" href="#instance"/> <p:input name="data" href="clubs.xml"/> <p:input name="config"> <response xsl:version="2.0"> <xsl:variable as="xs:string?" name="sportId" select="doc('input:instance')/request/sportId/value" /> <xsl:for-each select="//sport/name"> <row> <value><xsl:value-of select="../@id"/></value> <lang><xsl:value-of select="@lang"/></lang> <label><xsl:value-of select="."/></label> </row> </xsl:for-each> <toto> <xsl:value-of select="$sportId" /> </toto> </response> </p:input> <p:output name="data" ref="data"/> </p:processor> </p:config> If I send this to the webservice : <request> <sportId> toto </sportId> </request> I don't retrieve the value in the webservice.... |
Yes It works!
This the solution : <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://saxon.sf.net/" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://orbeon.org/oxf/xml/xmldb" xmlns:f="http://www.orbeon.com/oxf/function"> <p:param name="data" type="output"/> <p:processor name="oxf:request"> <p:input name="config"> <config> <include>/request/parameters/parameter[name = 'sportId']</include> </config> </p:input> <p:output name="data" id="request"/> </p:processor> <p:processor name="oxf:xslt"> <p:input name="request" href="#request"/> <p:input name="data" href="clubs.xml"/> <p:input name="config"> <response xsl:version="2.0"> <xsl:variable name="parameters" as="element(parameter)*" select="doc('input:request')/request/parameters/parameter"/> <xsl:variable name="sportId" as="xs:string?" select="$parameters[name = 'sportId']/value"/> <xsl:for-each select="//sport[@id = $sportId]/clubs/club/properties"> <row> <value><xsl:value-of select="../@id"/></value> <lang><xsl:value-of select="@lang"/></lang> <label><xsl:value-of select="name"/></label> </row> </xsl:for-each> </response> </p:input> <p:output name="data" ref="data"/> </p:processor> </p:config> In the form Builder I had to select the "HTML form" in the Serialization field. And I set my request body like that : <request> <sportId></sportId> </request> And now it works! Thank you for your help!! |
Administrator
|
OK, doing the HTML form serialization is another way to do it. I'm still not sure why it didn't work previously when doing a straight POST of the XML data, but I'm glad you got this to work. And thank you for the update,
Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |