Upload data from an external page in the Orbeon form

118 views
Skip to first unread message

inigo10rodri

unread,
Sep 7, 2018, 12:41:12 PM9/7/18
to orb...@googlegroups.com
Hello,

I would like to know if it is possible by configuring the properties,
creating a process or otherwise. Call another page from a link in the Orbeon
form, to fill in some data and then receive the data entered on the external
page within the Orbeon form.

Thank you,
Iñigo.

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

Alessandro Vernet

unread,
Sep 10, 2018, 12:15:02 PM9/10/18
to orb...@googlegroups.com
Hi Iñigo,

There is a way for you to POST the entire form data to a `/new` page (see
1st link below). But doing so has downsides: you need to POST the *exact*
XML document used by the page, which can be a maintenance issue as you'll
then need to change that data every time the form is changed.

Instead, in most cases the value of individual fields is passed to the form,
either:
1. As request parameters, if exposing those values to users isn't a problem.
2. As header values set in a reverse proxy, if you don't want users to be
able to see or change those values.

And of course you can use a combination of both techniques. Then you set
form fields to those values using `xxf:get-request-parameter()` for the 1st
case (see 2nd link below), or `xxf:get-request-header()` for the 2nd case
(see 3rd link below).

You'll let me know if this works for you.

https://doc.orbeon.com/configuration/properties/form-runner/form-runner-detail-page#initial-data-posted-to-the-new-form-page
https://doc.orbeon.com/xforms/xpath/extension-functions/extension-http#xxf-get-request-parameter
https://doc.orbeon.com/xforms/xpath/extension-functions/extension-http#xxf-get-request-header

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

Alessandro Vernet

unread,
Sep 17, 2018, 1:36:49 PM9/17/18
to orb...@googlegroups.com
Hi Iñigo, if this is still current, did you managed to pass information to
your form either as request parameters, or passing the whole data, per my
earlier message in this thread?


-Alex

inigo10rodri

unread,
Sep 19, 2018, 12:30:29 PM9/19/18
to orb...@googlegroups.com
Hello Alessandro,

I'm sorry for not answering you before, I was on vacation and trying out the
options you were proposing.

I have managed to send parameters by URL from a jsp that I created and I can
show it on the Orbeon form the value passed from the other page.
The problem that I have now is that I need to keep the data of the form, so
that when returning from the external page it shows the data that the user
had entered.
Is there any way to do it?

Thank you very much,
Iñigo

Alessandro Vernet

unread,
Sep 19, 2018, 1:06:30 PM9/19/18
to orb...@googlegroups.com
Hi Iñigo,

What do you mean by "keep the data of the form"? Are you saying that you
don't want the data you pass to the form not to be displayed to users?
(Maybe an example of what you'd like to create would help me understand the
issue you're trying to solve.)

-Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

inigo10rodri

unread,
Sep 20, 2018, 1:34:00 PM9/20/18
to orb...@googlegroups.com
Hi Alessandro,

What I want to say is that I have different entries in the form and once I
complete them, I access the external page through a link.
I complete the information on the external page and return to the form. But
when I return from the external page, the data I entered previously
disappears.
So, the question is whether there is any way to keep that data in the form
so that when it comes back from the external page, the entries that were
completed are not empty and is keeped what I had written?

I hope I have explained it better and that you can understand it, thank you.

Iñigo.

Alessandro Vernet

unread,
Sep 20, 2018, 6:08:06 PM9/20/18
to Orbeon Forms
Hi Iñigo,

Are you setting the value of those fields with an XPath expression you put in "Initial Value"? I imagine that XPath would call `xxf:get-request-parameter('gaga')`, or something along those lines. Then the value will be stored in the form data, and will be kept. If you reload data you saved previously, the value still be there.

Are you doing something like this? Or am misunderstanding your situation?

-Alex

inigo10rodri

unread,
Sep 21, 2018, 12:08:44 PM9/21/18
to orb...@googlegroups.com
Hi Alessandro,

Yes, I'm setting the value of those fields with the XPATH expression to
catch the parameter passed by the URL. The problem is not there, the value
of the parameters passed by request are loaded well in the corresponding
fields.

Let's put ourselves in situation:

The first thing I do is fill in the details of the form. Once I have filled
and saved everything correctly, I access the external page by a link to make
the digital signature.
After signing I return to the form and that's where the problem is, I do not
know how to show the data I had entered before going to make the digital
signature.
I had thought to redirect to the edit page and pass the document_id as a
parameter but I can not get it. Do you know if it could be possible?

Alessandro Vernet

unread,
Sep 24, 2018, 6:55:45 PM9/24/18
to orb...@googlegroups.com
Hi Iñigo,

Where did you put the XPath expression in Form Builder? Did you use the
"Initial Value" or "Calculated Value"? If you want the value to be set only
when opening the `/new` page, then you should use the "Initial Value". If
this is what you're doing, when you're then coming back to the form through
an `/edit` page, the value shouldn't be set again. Is this inline with what
you're seeing, or am misunderstanding your situation?

-Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

inigo10rodri

unread,
Sep 25, 2018, 12:47:47 PM9/25/18
to orb...@googlegroups.com
Hi Alessandro,

Yes, that has to do with what I'm doing but the problem is not there. I have
the XPath expression in "initial value" and it shows the value of the
parameter passed by URL correctly.

The problem is that the form is inside a proxy-portlet and I do not know how
to return to the form's edit within the proxy-portlet, by passing the
document_id by parameter.
Is there any way to get the document_id of the form and redirect the page to
the edit page within the proxy-portlet that is in Liferay?

Iñigo.

Alessandro Vernet

unread,
Sep 25, 2018, 1:27:07 PM9/25/18
to orb...@googlegroups.com
Got it Iñigo, then I'll let Erik follow-up on this one, as he knows the proxy
portlet better than I do, and should be able to help you open your data
there so the "Initial Value" expressions are not re-evaluated.

-Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

inigo10rodri

unread,
Sep 26, 2018, 2:45:30 PM9/26/18
to orb...@googlegroups.com
Thanks Alessandro,

Hope Erik can help me.

Iñigo.

Erik Bruchez

unread,
Sep 27, 2018, 1:33:29 AM9/27/18
to orb...@googlegroups.com
Iñigo,

I am not sure I have a good answer to the question. Let me see if I
understand well:

1. You show a form in the proxy portlet.
2. The user enters data in that form.
3. Then you have a link in that form which navigates to another "page".
- The purpose of that is to do a digital signature.
- Question: Is that page loaded from Liferay? How does it work?
4. Then you want to go back to the data captured by the form in point 2
above.

There is currently no mechanism whereby you can get back to the data except
if you save that data to the database, or if you somehow stored that data
somewhere else and then POST to the form to start over.

Are you currently trying to save the data to the database in point 2 before
going to point 3?

-Erik

inigo10rodri

unread,
Sep 27, 2018, 12:20:21 PM9/27/18
to orb...@googlegroups.com
Erik,

Yes, you understand well. The external page where the digital signature is
loaded from Liferay and then returns to the form filled in previously.

Right now I am creating a button with a process in which I save the data in
BD and then navigate to the URL of the digital signature page. But I can not
find the way to send the form data when clicking on the button.
Is there any way to send the form information, and then when you return from
the digital signature, load the form data filled in point 2 according to the
app-name, form-name and document-id?

Iñigo

inigo10rodri

unread,
Sep 28, 2018, 12:16:30 PM9/28/18
to orb...@googlegroups.com
Following this thread, I have seen that a possible solution would be to leave
the data (app-name, form-name, document-id) in session and retrieve them in
the Liferay proxy-portlet, but I do not know if this is possible.

Do you know if it would be possible or how could it be done?

Thank you very much,

Erik Bruchez

unread,
Oct 2, 2018, 2:04:10 AM10/2/18
to orb...@googlegroups.com
You might be able to do this by telling the proxy portlet to load the form
via URL parameters, see:


https://doc.orbeon.com/form-runner/link-embed/liferay-proxy-portlet#enabling-form-selection-via-url-parameters

Could this work for you?

The whole process is a bit clunky in the sense that you do have, somehow, to
tell the form, in addition, that signature has succeeded. Using a URL
parameter is dangerous because that could be hacked.

-Erik

inigo10rodri

unread,
Oct 2, 2018, 12:56:23 PM10/2/18
to orb...@googlegroups.com
I have already tried to pass parameters by URL, but the client does not want
the data to be passed by parameter. That's why we've been looking at how to
send the form data by session attributes.

But the thing is that I can not find the way to pass the form data by
session parameters through the link that leads to the digital signature
page.

Hope you can help me.

Iñigo

inigo10rodri

unread,
Oct 8, 2018, 6:15:04 AM10/8/18
to orb...@googlegroups.com
Hi again,

I´ve modified the process of the button clear with the properties-local.xml
file so that it calls a web service created by me transmiting the form data:

<property as="xs:string" name="oxf.fr.detail.process.clear.*.*" value='
save then send(uri =
"http://localhost:8181/o/service/services/clear", method="POST",
content="metadata",replace="all")'
/>

The thing is that I would like to send the form data through a link instead
of modifying the processes of the forms runner buttons.

It would be possible through xforms or another way, do the same?



Thank you,
Iñigo.

Alessandro Vernet

unread,
Oct 10, 2018, 8:11:53 PM10/10/18
to orb...@googlegroups.com
Hi Iñigo,

To summarize (and to make sure I understand your situation correctly!):

1. Users enter data in a form, click a button which saves the data in the
database, and loads a signature page, passing a reference to the document
id.
2. On that page, users sign the data, and on confirmation are sent back to
Orbeon Forms where the form is loaded, passing the document id to load using
the technique Erik mentioned earlier.

When users sign, I imagine that you store some information about that
signature. You could also assign a "signature id" to that signature, which
you pass to the form on step 2. On load you could call a service you
implement, checking that this signature id is indeed valid, and that the
data has been signed. In a situation like this, passing the signature id
doesn't expose any information. Would this work for you?

-Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

inigo10rodri

unread,
Oct 16, 2018, 4:16:20 AM10/16/18
to orb...@googlegroups.com
Hello Alessandro

You are right, but I have already resolved what you are talking about. I
pass the parameters by session, so users can not see the information that is
sent.

The thing is that I would like to send the form data through a link instead
of modifying the button processes of the forms broker.

Would it be possible through xforms or otherwise send the form data to a web
service using a link?

Thank you,
Iñigo

Alessandro Vernet

unread,
Oct 17, 2018, 12:47:32 AM10/17/18
to orb...@googlegroups.com
Hi Iñigo,

Could you clarify what you mean by "send the form data through a link
instead of modifying the button processes of the forms broker". Send the
form data from Orbeon Forms (I imagine) to where? What is the link you're
referring to? What is the downside for you of using a process tied to a
button?

-Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

inigo10rodri

unread,
Oct 17, 2018, 9:39:59 AM10/17/18
to orb...@googlegroups.com
Hi Alex,

What I want to say is that I want to make the same functionality as this
property with link created with a explanatory text:
<property as = "xs: string" name = "oxf.fr.detail.process.clear.*.*" value =
'
         save then send
(uri="http://localhost:8181/o/service/services/clear", method="POST",
content= "metadata", replace = "all") '
/>

The drawback to using the process linked to the button is that we want to be
able to customize it and place it in different areas of the form. Otherwise
the button would always appear in the bottom of the page.

Iñigo.

Alessandro Vernet

unread,
Oct 17, 2018, 5:59:24 PM10/17/18
to orb...@googlegroups.com
Hi Iñigo,

Got it, then:

1. Let's assume your button is named `my-button` (if you look at the source
of the form, the id of the control will be `my-button-control`).
2. Add the first property below and put the attached `model.xml` in your
`WEB-INF/resources/forms/resources/model.xml`. Note the listener in the
model that upon click (`DOMActivate`) on the button runs `my-process`.
3. Finally declare your process (here `my-process`) with the second property
below.

<property
as="xs:anyURI"
name="oxf.fr.detail.model.custom.*.*"
value="oxf:/forms/resources/model.xml"/>
<property
as="xs:string"
name="oxf.fr.detail.process.my-process.*.*">
success-message(message = "42")
</property>

You'll let me know if this works for you.

-Alex

model.xml <http://discuss.orbeon.com/file/t119778/model.xml>

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

inigo10rodri

unread,
Oct 23, 2018, 8:09:01 AM10/23/18
to orb...@googlegroups.com
Hi Alex,

It works perfectly, that's what I was looking for.

Thank you very much.

Iñigo.

Alessandro Vernet

unread,
Oct 23, 2018, 12:46:11 PM10/23/18
to orb...@googlegroups.com
Excellent Iñigo, I'm glad this way of running a process from a button inside
the form works for you, and thank you for the update! -Alex

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