Form to Form lose instances

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

Form to Form lose instances

Henrique Barros
Hi,

I have two forms. The main form has many instances that are loaded from a servlet via posted attributes.
That form has some button named 'edit' in a Grid. When we click in one of them a submission is made to the second form (editForm) with the instance data to be edited.

After editing we click in ok button that does a submission to the main form but when that is done I loose all the instances first loaded in the frst page. How can I keep them? In the Session? Or can I pass many instances from form to form? Passing them all would be the best for me. This is some of the code of the main page:

<xforms:submission ref="instance('form-to-send')" id="edit-submission"
                method="post" resource="/fr/dep/form2/new" replace="all"/>
               
        <xforms:instance id="form-to-send">
                                <form/>
            </xforms:instance>
            <xforms:instance id="fr-form-instance" src="input:instance" >
               <form/>
            </xforms:instance>
            <xforms:instance id="list_paper">
                <root/>
            </xforms:instance>
           
            <xforms:instance id="form-dados-externos">
                <root/>
            </xforms:instance>
           
           
            <xforms:action ev:event="xforms-model-construct-done">
                    <xforms:insert
                       nodeset="instance('list_paper')"
                       origin="xxforms:get-request-attribute('list_paper')"/>
                    <xforms:insert
                       nodeset="instance('form-dados-externos')"
                       origin="xxforms:get-request-attribute('form-dados-externos')"/>
            </xforms:action>



And this is some of the code of the editForm:

<xforms:submission id="previous-submission" resource="/fr/dep/form1/new"
            method="post" ref="instance('form-dados-externos')"/>
           
           <xforms:instance id="list_paper" src="input:instance">
                <root/>
            </xforms:instance>
           
            <xforms:instance id="form-dados-externos" src="input:instance">
                <root/>
            </xforms:instance>

<xforms:instance id="fr-form-instance" src="input:instance">


Using the inspector I can see that in the second form the instances o the main form are not loaded.
What can I do?

Henrique Barros
Reply | Threaded
Open this post in threaded view
|

Re: Form to Form lose instances

Erik Bruchez
Administrator
It's usually frowned upon to use the session because doing it right
(e.g. support a workflow with multiple browser tabs/windows) is pretty
hard.

And unfortunately there is no simple mechanism to pass multiple
instances from form to form (some kind of multipart POST could be
implemented to submit and read multiple instances but that's not there
at this point).One instance is ok though: just post it to the other
form.

What you could try to do is aggregate all your instances under a
single root element, then post them.

-Erik

On Fri, Oct 26, 2012 at 3:43 AM, Henrique Barros <[hidden email]> wrote:

> Hi,
>
> I have two forms. The main form has many instances that are loaded from a
> servlet via posted attributes.
> That form has some button named 'edit' in a Grid. When we click in one of
> them a submission is made to the second form (editForm) with the instance
> data to be edited.
>
> After editing we click in ok button that does a submission to the main form
> but when that is done I loose all the instances first loaded in the frst
> page. How can I keep them? In the Session? Or can I pass many instances from
> form to form? Passing them all would be the best for me. This is some of the
> code of the main page:
>
> /<xforms:submission ref="instance('form-to-send')" id="edit-submission"
>                 method="post" resource="/fr/dep/form2/new" replace="all"/>
>
>                 <xforms:instance id="form-to-send">
>                                 <form/>
>             </xforms:instance>
>             <xforms:instance id="fr-form-instance" src="input:instance" >
>                <form/>
>             </xforms:instance>
>             <xforms:instance id="list_paper">
>                 <root/>
>             </xforms:instance>
>
>             <xforms:instance id="form-dados-externos">
>                 <root/>
>             </xforms:instance>
>
>
>             <xforms:action ev:event="xforms-model-construct-done">
>                     <xforms:insert
>                        nodeset="instance('list_paper')"
>                        origin="xxforms:get-request-attribute('list_paper')"/>
>                     <xforms:insert
>                        nodeset="instance('form-dados-externos')"
>
> origin="xxforms:get-request-attribute('form-dados-externos')"/>
>             </xforms:action>/
>
>
> And this is some of the code of the editForm:
>
> /<xforms:submission id="previous-submission" resource="/fr/dep/form1/new"
>             method="post" ref="instance('form-dados-externos')"/>
>
>            <xforms:instance id="list_paper" src="input:instance">
>                 <root/>
>             </xforms:instance>
>
>             <xforms:instance id="form-dados-externos" src="input:instance">
>                 <root/>
>             </xforms:instance>
>
> <xforms:instance id="fr-form-instance" src="input:instance">/
>
> Using the inspector I can see that in the second form the instances o the
> main form are not loaded.
> What can I do?
>
> Henrique Barros
>
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Form-to-Form-lose-instances-tp4655921.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: Form to Form lose instances

Stian Sigvartsen
In reply to this post by Henrique Barros
RE: [ops-users] Re: Form to Form lose instances

Hi Henrique.

Eric is right, using sessions is usually a problematic solution. Have you considered possibly running your forms on a JSR286 compliant portal platform like Liferay Portal?

I think I may have implemented a similar screenflow to what you described by building individual portlets rendering read-only XForms with edit buttons to bring the portlet into full screen mode to edit the instance data. I stored the individual XForms default instances into the portlet session, which is a slightly different concept to servlet session. I think might be a good approach if all your instances really don't have any inter-dependency on each other, possibly representing different sections of an overall "form" submission (from user perspective). Finally you need to have a portlet which gathers together all the individual portlet's session stored XForms instances when a button is pressed and sends them all for processing in a single transaction. This can be achieved via JSR286 events.

-Stian


-----Original Message-----
From: Erik Bruchez [[hidden email]]
Sent: Tue 30/10/2012 05:57
To: [hidden email]
Subject: [ops-users] Re: Form to Form lose instances

It's usually frowned upon to use the session because doing it right
(e.g. support a workflow with multiple browser tabs/windows) is pretty
hard.

And unfortunately there is no simple mechanism to pass multiple
instances from form to form (some kind of multipart POST could be
implemented to submit and read multiple instances but that's not there
at this point).One instance is ok though: just post it to the other
form.

What you could try to do is aggregate all your instances under a
single root element, then post them.

-Erik

On Fri, Oct 26, 2012 at 3:43 AM, Henrique Barros <[hidden email]> wrote:
> Hi,
>
> I have two forms. The main form has many instances that are loaded from a
> servlet via posted attributes.
> That form has some button named 'edit' in a Grid. When we click in one of
> them a submission is made to the second form (editForm) with the instance
> data to be edited.
>
> After editing we click in ok button that does a submission to the main form
> but when that is done I loose all the instances first loaded in the frst
> page. How can I keep them? In the Session? Or can I pass many instances from
> form to form? Passing them all would be the best for me. This is some of the
> code of the main page:
>
> /<xforms:submission ref="instance('form-to-send')" id="edit-submission"
>                 method="post" resource="/fr/dep/form2/new" replace="all"/>
>
>                 <xforms:instance id="form-to-send">
>                                 <form/>
>             </xforms:instance>
>             <xforms:instance id="fr-form-instance" src="input:instance" >
>                <form/>
>             </xforms:instance>
>             <xforms:instance id="list_paper">
>                 <root/>
>             </xforms:instance>
>
>             <xforms:instance id="form-dados-externos">
>                 <root/>
>             </xforms:instance>
>
>
>             <xforms:action ev:event="xforms-model-construct-done">
>                     <xforms:insert
>                        nodeset="instance('list_paper')"
>                        origin="xxforms:get-request-attribute('list_paper')"/>
>                     <xforms:insert
>                        nodeset="instance('form-dados-externos')"
>
> origin="xxforms:get-request-attribute('form-dados-externos')"/>
>             </xforms:action>/
>
>
> And this is some of the code of the editForm:
>
> /<xforms:submission id="previous-submission" resource="/fr/dep/form1/new"
>             method="post" ref="instance('form-dados-externos')"/>
>
>            <xforms:instance id="list_paper" src="input:instance">
>                 <root/>
>             </xforms:instance>
>
>             <xforms:instance id="form-dados-externos" src="input:instance">
>                 <root/>
>             </xforms:instance>
>
> <xforms:instance id="fr-form-instance" src="input:instance">/
>
> Using the inspector I can see that in the second form the instances o the
> main form are not loaded.
> What can I do?
>
> Henrique Barros
>
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Form-to-Form-lose-instances-tp4655921.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: [hidden email]
> For general help: [hidden email]
> OW2 mailing lists service home page: http://www.ow2.org/wws
>



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: Form to Form lose instances

Henrique Barros
Hi,

Thank you all for your solutions. Yes I figured out that it's not possible to send multiple, I tested agregating all in one and it worked. But now I'm using Sessions like this: "nameSession_documentUuid" And I pass the uuid in the main instance from form to form in order to get the other instances via session. This way all sessions are unique, I guess, and I can use more than one form at the same time.

Henrique Barros