Retrieving Orbeon form in certain state

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

Retrieving Orbeon form in certain state

Tambet Matiisen
Hi everyone!

We have implemented a custom solution for generating PDFs for forms made
"by hand", ie not with Form Builder. The idea is similar to the one
described in Orbeon's wiki:
http://wiki.orbeon.com/forms/how-to/other/generate-pdf

It works fairly well for simple forms, but we are struggling with more
complex ones:
  * If form contains <xforms:switch> and several <xforms:case>-s, then
PDF always shows the first case.
  * If form contains <xforms:repeat> and a subform, which displays data
of active row of that repeat (using <xforms:group
ref="repeated-element[index('id-of-repeat')]">), then PDF always
displays the first row, not the one that user has selected.

So far we have solved the first problem by giving id of the case, that
needs to be activated, as a parameter to PDF generation routine. Before
generating PDF the XForms is modified to include <xforms:toggle
case="the-case" events:event="xforms-ready"/> in the model. As our forms
always contain only one switch, this has worked so far.

The problem of repeat index is more complex, because we could have any
number of repeats in the form and we don't want to make any
modifications to the original form.

My question is - is there a way to retrieve Orbeon form in a certain
state? I know, that all states are enumerated and this information is
used for Back button processing. If I could ask Orbeon to return HTML
for a form in a certain state, then it would relieve me from
prepopulating instances, adding instructions to activate right case and
setting repeat indexes to the original position. Do you think this is
possible? Also - what is the purpose of data and instance parameters of
oxf:xforms-to-xhtml processor?

Regards
Tambet


--
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: Retrieving Orbeon form in certain state

Erik Bruchez
Administrator
Tambet,

The XForms engine only stores the initial and current state, but not
intermediary states. So this wouldn't work at this time I think.

Question: if you can solve the issue of switch/case with
xforms:toggle, can't you solve the issue of repeats with
xforms:setindex?

-Erik

On Thu, Jun 9, 2011 at 3:20 AM, Tambet Matiisen
<[hidden email]> wrote:

> Hi everyone!
>
> We have implemented a custom solution for generating PDFs for forms made "by
> hand", ie not with Form Builder. The idea is similar to the one described in
> Orbeon's wiki:
> http://wiki.orbeon.com/forms/how-to/other/generate-pdf
>
> It works fairly well for simple forms, but we are struggling with more
> complex ones:
>  * If form contains <xforms:switch> and several <xforms:case>-s, then PDF
> always shows the first case.
>  * If form contains <xforms:repeat> and a subform, which displays data of
> active row of that repeat (using <xforms:group
> ref="repeated-element[index('id-of-repeat')]">), then PDF always displays
> the first row, not the one that user has selected.
>
> So far we have solved the first problem by giving id of the case, that needs
> to be activated, as a parameter to PDF generation routine. Before generating
> PDF the XForms is modified to include <xforms:toggle case="the-case"
> events:event="xforms-ready"/> in the model. As our forms always contain only
> one switch, this has worked so far.
>
> The problem of repeat index is more complex, because we could have any
> number of repeats in the form and we don't want to make any modifications to
> the original form.
>
> My question is - is there a way to retrieve Orbeon form in a certain state?
> I know, that all states are enumerated and this information is used for Back
> button processing. If I could ask Orbeon to return HTML for a form in a
> certain state, then it would relieve me from prepopulating instances, adding
> instructions to activate right case and setting repeat indexes to the
> original position. Do you think this is possible? Also - what is the purpose
> of data and instance parameters of oxf:xforms-to-xhtml processor?
>
> Regards
> Tambet
>
>
> --
> 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: Retrieving Orbeon form in certain state

Tambet Matiisen
Erik,

I was thinking of storing all instances, active switch cases and active
repeat indexes in session using xxforms:set-session-attribute(). I think
I can make such modifications in preprocessing stylesheet, so that
original form stays intact. Then, when rendering PDF, I use another
stylesheet, that prepopulates instances, sets active cases and repeat
indexes with xxforms:get-session-variable(). This way original forms
don't need any modification. I'm slightly worried about resource
consumption and performance, but it shouldn't be too bad, as in worst
case it only doubles the amount space needed. And the traffic between
client and server is minimal, as instances are copied on server side.

Now I have to find time to try it out...

   Tambet

On 16.06.2011 8:00, Erik Bruchez wrote:

> Tambet,
>
> The XForms engine only stores the initial and current state, but not
> intermediary states. So this wouldn't work at this time I think.
>
> Question: if you can solve the issue of switch/case with
> xforms:toggle, can't you solve the issue of repeats with
> xforms:setindex?
>
> -Erik
>
> On Thu, Jun 9, 2011 at 3:20 AM, Tambet Matiisen
> <[hidden email]>  wrote:
>> Hi everyone!
>>
>> We have implemented a custom solution for generating PDFs for forms made "by
>> hand", ie not with Form Builder. The idea is similar to the one described in
>> Orbeon's wiki:
>> http://wiki.orbeon.com/forms/how-to/other/generate-pdf
>>
>> It works fairly well for simple forms, but we are struggling with more
>> complex ones:
>>   * If form contains<xforms:switch>  and several<xforms:case>-s, then PDF
>> always shows the first case.
>>   * If form contains<xforms:repeat>  and a subform, which displays data of
>> active row of that repeat (using<xforms:group
>> ref="repeated-element[index('id-of-repeat')]">), then PDF always displays
>> the first row, not the one that user has selected.
>>
>> So far we have solved the first problem by giving id of the case, that needs
>> to be activated, as a parameter to PDF generation routine. Before generating
>> PDF the XForms is modified to include<xforms:toggle case="the-case"
>> events:event="xforms-ready"/>  in the model. As our forms always contain only
>> one switch, this has worked so far.
>>
>> The problem of repeat index is more complex, because we could have any
>> number of repeats in the form and we don't want to make any modifications to
>> the original form.
>>
>> My question is - is there a way to retrieve Orbeon form in a certain state?
>> I know, that all states are enumerated and this information is used for Back
>> button processing. If I could ask Orbeon to return HTML for a form in a
>> certain state, then it would relieve me from prepopulating instances, adding
>> instructions to activate right case and setting repeat indexes to the
>> original position. Do you think this is possible? Also - what is the purpose
>> of data and instance parameters of oxf:xforms-to-xhtml processor?
>>
>> Regards
>> Tambet
>>
>>
>> --
>> 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