Re: [Xsltforms-support] Building up URLs from selected values
Brought to you by:
alain-couthures
|
From: Steven P. <ste...@cw...> - 2023-11-23 21:18:56
|
What you have to realise is that <instance src="..." .../> is done during
XForms initialisation, while other instances are also being initialised. So
if you are depending on the other instances in order to get your values to
initialise an instance, you're going to be in trouble.
What you need to do is allow your static instances to be initialised, and
then initialise your dynamic instances.
You do that with a submission:
<submission id="initfiles" resource="{SearchResultsUrl}"
replace="instance" instance="files"/>
(Or on older XForms systems
<submission id="initfiles" replace="instance" instance="files"><resource
value="SearchResultsUrl"/></submission>
)
and cause this to be done when initialisation is finished:
<action ev:event="xforms-ready">
<send submission="initfiles"/>
</action>
(or the shorter version
<send submission="initfiles" ev:event="xforms-ready"/>
)
Hope this helps.
Steven
On Thursday 23 November 2023 17:15:18 (+01:00), Richard Light wrote:
Thanks, Steven.
Dumb follow-up question: if I have the URL I want to load as a data item,
what syntax do I use in the src attribute to specify that I want to use the
value of that data item as the URL to load? Or do I use ref? This is what
I have:
Whatever syntax I use for line 58, I get an xforms-link-exception when I
load the form. (I'm also trying to prevent the "indexes" instance from
being used until File is specified. That attribute doesn't seem to be
making any difference either.)
Thanks,
Richard
On 22/11/2023 20:28, Steven Pemberton wrote:
Attribute value templates work in XForms too, and allow you to build up a
URL, but you can also use <bind/> with a calculate, see for instance the
section on maps in the XForms advanced tutorial:
http://www.cwi.nl/~steven/xforms/advanced/
Best wishes,
Steven
On Wednesday 22 November 2023 18:18:29 (+01:00), Richard Light wrote:
Hi,
I have an XForms scenario where I am interacting with an API, so every item
of data is fetched via a URL. I want to start with the selection of a file.
That's straightforward, because I can quote the complete URL to get a list
of possible values:
The problem occurs when I then want to include the selected file name in
the URL for the next stage of the query, which is to select the index to
search. This is the sort of thing I would do in XSLT, using an AVT:
What is the equivalent XForms/XsltForms syntax for including an entered
value within a string?
Thanks,
Richard
--
Richard Light
ric...@gm... <mailto:ric...@gm...>
@richardofsussex
--
Richard Light
ric...@gm... <mailto:ric...@gm...>
@richardofsussex |