How to fill up a form with data that has been collected in another form

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

How to fill up a form with data that has been collected in another form

vicaed
Hi Alex,

I will try to explain what I want to do exposing a simple proof of concept.
Let's say that I have a form where users insert a set of data, then I call a
web service using this data as parameters and the web service responds with
another set of data. My goal is to show users the response data (which I get
from the web service and it is not a single but multiples values) in another
form. It could be resum as how to obtain a form as output of another form.
The output form would be only a way to show the output data to users in a
nice format.
The idea is something like:  user fill the required values in the first form
---> press send or submit --> web service is called with the values that
user has inserted --> user is redirected to another form (which has been
previously created with orbeon builder) which is automatically fill with the
values returned by the web service

I have read this link:
https://doc.orbeon.com/xforms/howtos/initial-data.html , about how to load
initial data in a form, but I am not sure if it is the right way. Also there
is a link in the documentation with the text /NOTE: If you design your forms
with Form Builder, rather than writing XForms by hand, see how to load an
initial instance in Form Runner/, but i don´t find information about that in
this link.

Do you think it is possible to do that using orbeon?
If the answer is yes, I would appreciate your guiding me to relevant sources
on this topic, as well as any suggestion you may have concerning.

Or maybe the correct way to face this problem is generate the output form
dinamically using servets or jsp?
 

--
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 post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

Alessandro  Vernet
Administrator
Hi Vincente,

Indeed, the link on that page was incorrect. It should have pointed to the
section linked below. (I just fixed that; thank you for letting us know
about it!)

It sounds to me like you're looking for something along the lines of what is
described in the second section there ("Initial data from service"). But
this assumes that you are providing the service, which means that you would
have to write the service that creates the initial XML instance. This gives
you a lot of flexibility in how you create that initial data, but also
creates a dependency between the form in Form Builder and that code you
write to generate the initial data, which makes modifying the form down the
road more tricky.

https://doc.orbeon.com/configuration/properties/form-runner-detail-page.html#initial-data

Another way, is to load the data from a service you provide, store it in a
"dataset", and use that dataset to populate fields. See:

https://doc.orbeon.com/form-runner/feature/datasets.html

You'll let me know if this helps.

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 post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

vicaed
Hi Alex,

Thanks for your advice, but I think it is not enought for that I want to do,
because I need also navegate between pages. So the question is, it is
possible in the context of form builder/runner
navigate between pages (every page would be a different form). I have read
this documentation
https://doc.orbeon.com/xml-platform/controller/basics.html. But it sounds me
like you have to create your own app out of the form builder, like
the bookcast example. According to this document you have to create a
page-flow.xml and put it inside of your app, but how do you do it if your
forms are running inside of the form runner context?

--
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 post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

Alessandro  Vernet
Administrator
Hi Vincente,

Are you referring to configuring what other form users are potentially taken
to when they submit data from a form? If so, this can be done by configuring
the "process" that runs when users press a button at the bottom of a form.
In particular, the `navigate()` action allows you to configure where users
are taken next. You'll let me know if this is inline with what you're
looking for.

https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/

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 post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

vicaed
This post was updated on .
Hi Alex,

Yes it is that I wanted, thanks you. Then I understand that with this
property:

<property as="xs:string"
name="oxf.fr.detail.process.send.Testing.Test-navigation" >
                send(
                        uri        = "http://localhost:8080/orbeon/fr/Testing/Test-destination     
/edit/40642cae5f2422153efd2d5f8e852087e8d215a0",
                        method     = "PUT",
                        content    = "xml"
                )
                then
navigate("http://localhost:8080/orbeon/fr/Testing/Test-destination/edit/40642cae5f2422153efd2d5f8e852087e8d215a0")
    </property>

You send the form data to
"http://localhost:8080/orbeon/fr/Testing/Test-destination     
/edit/40642cae5f2422153efd2d5f8e852087e8d215a0" and you redirect the user to
"http://localhost:8080/orbeon/fr/Testing/Test-destination/edit/40642cae5f2422153efd2d5f8e852087e8d215a0",
that in this case is the same url. That's right?.

Now the next step is how to get the data that you send from the Test-origen
form in the Test-destination form. I have read this
https://doc.orbeon.com/configuration/properties/form-runner-detail-page.html#initial-data,
but it only tells you that the data is posted in the form instance data, but
how to select specific data from the instance data in order to fill some
form fields?




--
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 orbeon+unsubscribe@googlegroups.com.
To post to this group, send email to orbeon@googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

Alessandro  Vernet
Administrator
Hi Vincente,

That PUT will have no effect, other than produce an error ;). It sounds as
if you want to pass the data from "Test-origin" to another form
"Test-navigation". Is this because you want to pre-populate certain fields
in "Test-navigation" with values coming from fields in "Test-origin"? If so,
how many such fields like this do you have (roughly)?

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 post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

vicaed
Hi Alex, yes it is exactly that I want to do. It would be about 8 fields, so
I would prefere don't do it by parameters in the url.

--
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 post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

Alessandro  Vernet
Administrator
Hi Vincente,

Say you have a form `a/a` and you setup the "Send" button to send the XML to
form `b/b` as follows:

    <property as="xs:string"
name="oxf.fr.detail.buttons.a.a">send</property>
    <property as="xs:string"  name="oxf.fr.detail.process.send.a.a">
        send(
            uri = "/fr/b/b/new",
            replace = "all",
            parameters = ""
        )
    </property>

The issue is that form `b/b` will take that XML document it receives and use
it as its initial document. This will only work if both forms have exactly
the same model. But this isn't what you want: you'd like to extract values
from the XML document you received from `a/a` to populate the XML document
for `b/b`.

So, I'm afraid you'll have to resort to parameters. And note that the POST
is done on the server; it doesn't even go through HTTP locally, so you don't
have to worry about the size of the data you send. (There might still be a
limit somewhere, but if so it will be most likely higher than what is
imposed by a browser or Tomcat.) You'll let me know if this works for you.

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 post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

vicaed
Hi Alex, thanks for your answer. At end I did it with hide sections following
this tutorial:
http://wiki.orbeon.com/forms/how-to/fb-fr/form-builder-wizard. It is ok for
that I need so far, but it is good to know other options. Thanks you!

--
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 post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

Alessandro  Vernet
Administrator
Got it Vincente, and yes, using a wizard is a also a good way to go, instead
of creating separate forms. I should have mentioned this earlier, and I'm
glad you found about it on your own.

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 post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

vicaed
In reply to this post by Alessandro Vernet
Hi alex, please let me retome this question. I tried that you posted here:
  <property as="xs:string"
name="oxf.fr.detail.buttons.a.a">send</property>
    <property as="xs:string"  name="oxf.fr.detail.process.send.a.a">
        send(
            uri = "/fr/b/b/new",
            replace = "all",
            parameters = ""
        )
    </property>

But then user is not redirect to form b, and I need to do it. If I add:
<property as="xs:string"
                name="oxf.fr.detail.buttons.a.a">send</property>
       
        <property as="xs:string" name="oxf.fr.detail.process.send.a.a" >
                 send(
           uri = "/fr/b/b/new",
            replace = "all",
            parameters = ""
        )
        then navigate("/fr/b/b/new")
    </property>
 I get the next error:
Unable to run a two-pass submission and xf:load within a same action
sequence.

and if i change replace = "all" by replace="instance" then I get a different
error:
Body received with non-XML media type for `replace="instance"`: text/html

Some idea about where can be the problem?  

--
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 post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

Alessandro  Vernet
Administrator
Hi Vincente,

I thought you were going to use the wizard mode, instead of using multiple
forms; were you unable to use the wizard mode somehow?

If you want to take the user from form A to form B, then just use
`navigate("/fr/b/b/new")` or `send(method = "GET")` in your process. But
also make sure to save the data before that in the process, otherwise
anything the user has entered will be lost.

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 post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

vicaed
This post was updated on .
Hi Alex, Yes I used the wizard mode and It worked fine. That I want to do now is a different thing, but i thought it would be better following in this thread instead open a new one. The question is that in our app when users send a form they are redirect to a new page which is dynamically created by a service, in this page they can see a success message informing that the form have been sent and some more information like a id number and some other details, all these information is already in the original form (form a). Then I thought that a shortcut could be to have ready another orbeon form let call it form b, with the success message and the other information. That's why I wanted to explore the posibility to recover data from form a in form b and in the same process redirect users also from form a to form b. First at all tell you that if there is not an easy way to do it, no problem, we can do it using the service.

Then to resum, I would like to know if there is an easy way to do both in the same process:
1) Redirect user from form a to another orbeon form (b) previously created and saved in the bd.
2) Fill some fields of form b with the content data of some fields of form a

In a previous post you wrote:

 /<property as="xs:string"
name="oxf.fr.detail.buttons.a.a">send</property>
    <property as="xs:string"  name="oxf.fr.detail.process.send.a.a">
        send(
            uri = "/fr/b/b/new",
            replace = "all",
            parameters = ""
        )
    </property>

The issue is that form `b/b` will take that XML document it receives and use
it as its initial document. This will only work if both forms have exactly
the same model. But this isn't what you want: you'd like to extract values
from the XML document you received from `a/a` to populate the XML document
for `b/b`./

And Indeed I think this is the best approach, but unfortunally it does not
work if I add the navigate action in the same process. It is the problem?,
It is not possible to send data from form a to form b and at the same time
redirect user from form a to form b?. I hope I have explained correctly
every thing, if something is not clear for you don´t hesitate to ask again.






--
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 orbeon+unsubscribe@googlegroups.com.
To post to this group, send email to orbeon@googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

Alessandro  Vernet
Administrator
Hi Vincente,

If you want to send values from form A to form B, and load form B, then you
need to use a `method="GET" replace="all"`, and pass the values as request
parameters. There is an example that shows how to extract values from the
XML and pass them as a request parameters to the service you're calling in
the section linked below. Also note that the call is made on the server, so
it is "safe", in the sense that users won't be able to change (or even see)
the value of those parameters.

https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/actions-form-runner-send.html#properties-and-xpath-value-templates

And like you said, you can't use a POST and pass the XML, as the 2 forms
most likely don't have the same XML data structure; you need to use a GET
and use request parameters. You'll let me know if this can work with the use
case you have in mind.

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 post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

vicaed
Hi Alex, It does not work. I tried that you says:

<property as="xs:string" name="oxf.fr.detail.process.send.Testing.origen" >
                send(
                        uri        = "http://localhost:8080/orbeon/fr/Testing/destino/new",
                        replace = "all",
                        method     = "GET"
                )
                then navigate("http://localhost:8080/orbeon/fr/Testing/destino/new")
    </property>

then i get this error:
Unable to run a two-pass submission and xf:load within a same action
sequence

I think the problem is that this is thought to use a service, please notice
that in the use case that i have on mind there is not service, only two
orbeo forms. So, maybe it is not possible to pass parameters between two
orbeon forms directly (it is without using an intermediate service) ?

--
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 post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: How to fill up a form with data that has been collected in another form

Alessandro  Vernet
Administrator
Hi Vincente,

Try removing the `then navigate(…)`. Your `send()` does this already. The
`replace="all"` means "take whatever is returned by this service and send it
to the browser (acting as a sort of reverse proxy). You'll let me know if
this works.

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 post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet