How to load initial instance posted to new form

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

How to load initial instance posted to new form

Han Ming Low
Hi,
 
I'm trying to follow the instruction at
to load the initial instance posted to the form with a base64 encoded parameter "fr-form-data"
I did add in
<property as="xs:boolean" name="oxf.fr.detail.new.accept-post.*.*" value="true"/>
to my properties-local.xml
 
However, I'm not sure how can I load this data.
I try to follow the instruction at
ie.
<xforms:instance id="fr-form-data" src="input:instance"/>
 
Is this correct?
 
When I try to do
<xforms:output ref="instance('fr-form-data')"/>
It always show the path of my form
e.g.
Then, the output will be testTestFormnew
 
<xforms:output ref="instance('fr-form-data')/form/control-1/field-1"/>
Will show empty value
 
What is the correct way of doing it?
 
Thanks.
 
 
Han Ming


--
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: How to load initial instance posted to new form

Hank Ratzesberger-2
Hi Han Ming,

Will the user arrive at the page from another form?  It could be any page that makes the proper post, 
even a regular html form.  Form Runner will handle this -- it appears you have configured it to do so.

As I understand, FR will handle the post and you don't need to edit the source to add the 
input:instance.

Also in FR, if you enter values into the input fields you create, they become the initial 
values when the form is loaded.  Perhaps that is all that you need?

Regards,
Hank




On Aug 12, 2010, at 8:36 PM, Han Ming Low wrote:

Hi,
 
I'm trying to follow the instruction at
to load the initial instance posted to the form with a base64 encoded parameter "fr-form-data"
I did add in
<property as="xs:boolean" name="oxf.fr.detail.new.accept-post.*.*" value="true"/>
to my properties-local.xml
 
However, I'm not sure how can I load this data.
I try to follow the instruction at
ie.
<xforms:instance id="fr-form-data" src="input:instance"/>
 
Is this correct?
 
When I try to do
<xforms:output ref="instance('fr-form-data')"/>
It always show the path of my form
e.g.
Then, the output will be testTestFormnew
 
<xforms:output ref="instance('fr-form-data')/form/control-1/field-1"/>
Will show empty value
 
What is the correct way of doing it?
 
Thanks.
 
 
Han Ming

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

Hank Ratzesberger
NEES@UCSB
Earth Research Institute
University of California, Santa Barbara
805-893-8042








--
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: How to load initial instance posted to new form

Han Ming Low
Hi Hank,
 
Thanks for the reply.
 
Ideally, yes, I would like it the 1st form to be submitted to the 2nd form and the 2nd form can use the value submitted from the first form.
 
However, as I was told previously, the 1st form will submit its data as xml in the body and the 2nd form will load it's initial instance as a request parameter "fr-form-data" encoded in base64 encoding, thus, 2nd form would not be able to pick it up without any intervention.
 
So, I wrote a servlet that intercept the request and inserted a new parameter "fr-form-data" with data that is base64 encoded.
However, if that is not required, I can gladly remove this layer.
 
If the xml submit from the 1st form in the body is
<?xml version="1.0" encoding="UTF-8"?>
<form>
        <section-1>
            <name>Test</name>
        </section-1>
</form>
 
then what is the code that I should write in 2nd form to print out the value submitted from the first form?
 
Thanks in advance for any advice.
 
 
 
Han Ming
 
 


 
On Sat, Aug 14, 2010 at 5:16 AM, Hank Ratzesberger <[hidden email]> wrote:
Hi Han Ming,

Will the user arrive at the page from another form?  It could be any page that makes the proper post, 
even a regular html form.  Form Runner will handle this -- it appears you have configured it to do so.

As I understand, FR will handle the post and you don't need to edit the source to add the 
input:instance.

Also in FR, if you enter values into the input fields you create, they become the initial 
values when the form is loaded.  Perhaps that is all that you need?

Regards,
Hank




On Aug 12, 2010, at 8:36 PM, Han Ming Low wrote:

Hi,
 
I'm trying to follow the instruction at
to load the initial instance posted to the form with a base64 encoded parameter "fr-form-data"
I did add in
<property as="xs:boolean" name="oxf.fr.detail.new.accept-post.*.*" value="true"/>
to my properties-local.xml
 
However, I'm not sure how can I load this data.
I try to follow the instruction at
ie.
<xforms:instance id="fr-form-data" src="input:instance"/>
 
Is this correct?
 
When I try to do
<xforms:output ref="instance('fr-form-data')"/>
It always show the path of my form
e.g.
Then, the output will be testTestFormnew
 
<xforms:output ref="instance('fr-form-data')/form/control-1/field-1"/>
Will show empty value
 
What is the correct way of doing it?
 
Thanks.
 
 
Han Ming

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

Hank Ratzesberger
NEES@UCSB
Earth Research Institute
University of California, Santa Barbara
805-893-8042








--
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: Re: How to load initial instance posted to new form

Hank Ratzesberger-2
Hi Han,

Sorry not much help lately....

I am taking a best guess here. 

The xforms-model-ready event is helpful within the model to process 
data before the form is active for the user.  It occurs only once when 
the form is loaded.  You can call xpl scripts or use insert and xpath 
functions to manipulate the base64 instance into the fr-form-data
(it being declared but empty).

Not that the following will work, cut and paste:

<xf:model id="fr-form-model">

  <xf:action ev:event="xforms-ready">
    <xf:insert nodeset="instance('real-fr-instance')" origin="xxforms:call-xpl('oxf:/some-base64-translator-script.xpl', 'data', instance('input:instance'), 'data')"/>
</xf:action>

  <xf:instance id="real-fr-instance">
    <form xmlns=""/>
  </xf:instance>

</xf:model>

 

--Hank


On Aug 15, 2010, at 8:31 PM, Han Ming Low wrote:

Hi Hank,
 
Thanks for the reply.
 
Ideally, yes, I would like it the 1st form to be submitted to the 2nd form and the 2nd form can use the value submitted from the first form.
 
However, as I was told previously, the 1st form will submit its data as xml in the body and the 2nd form will load it's initial instance as a request parameter "fr-form-data" encoded in base64 encoding, thus, 2nd form would not be able to pick it up without any intervention.
 
So, I wrote a servlet that intercept the request and inserted a new parameter "fr-form-data" with data that is base64 encoded.
However, if that is not required, I can gladly remove this layer.
 
If the xml submit from the 1st form in the body is
<?xml version="1.0" encoding="UTF-8"?>
<form>
        <section-1>
            <name>Test</name>
        </section-1>
</form>
 
then what is the code that I should write in 2nd form to print out the value submitted from the first form?
 
Thanks in advance for any advice.
 
 
 
Han Ming
 
 


 
On Sat, Aug 14, 2010 at 5:16 AM, Hank Ratzesberger <[hidden email]> wrote:
Hi Han Ming,

Will the user arrive at the page from another form?  It could be any page that makes the proper post, 
even a regular html form.  Form Runner will handle this -- it appears you have configured it to do so.

As I understand, FR will handle the post and you don't need to edit the source to add the 
input:instance.

Also in FR, if you enter values into the input fields you create, they become the initial 
values when the form is loaded.  Perhaps that is all that you need?

Regards,
Hank




On Aug 12, 2010, at 8:36 PM, Han Ming Low wrote:

Hi,
 
I'm trying to follow the instruction at
to load the initial instance posted to the form with a base64 encoded parameter "fr-form-data"
I did add in
<property as="xs:boolean" name="oxf.fr.detail.new.accept-post.*.*" value="true"/>
to my properties-local.xml
 
However, I'm not sure how can I load this data.
I try to follow the instruction at
ie.
<xforms:instance id="fr-form-data" src="input:instance"/>
 
Is this correct?
 
When I try to do
<xforms:output ref="instance('fr-form-data')"/>
It always show the path of my form
e.g.
Then, the output will be testTestFormnew
 
<xforms:output ref="instance('fr-form-data')/form/control-1/field-1"/>
Will show empty value
 
What is the correct way of doing it?
 
Thanks.
 
 
Han Ming

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

Hank Ratzesberger
NEES@UCSB
Earth Research Institute
University of California, Santa Barbara
805-893-8042








--
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: [hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Hank Ratzesberger
NEES@UCSB
Earth Research Institute
University of California, Santa Barbara
805-893-8042








--
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: Re: Re: How to load initial instance posted to new form

Han Ming Low
Hi Hank,
 
Sorry for my late reply.
 
Thanks for the tip.
 
I still have to test it out.
In the meantime, I try testing the following.
 
Form1 with the fr-form-instance as follows
<form>
  <section-1>
    <name />
  </section-1>
</form>
 
It will submit to a servlet which will convert the xml body to a fr-form-instance parameter with the xml changed to a base64 encoding, then it will redirect the request to /test/Form2/new
My Form2 has the following fr-form-instance
<form>
  <section-1>
    <name />
  </section-1>
  <section-2>
    <address />
  </section-2>
</form>
 
This time, the data I have keyed in at Form1 is loaded on Form2.
However, I found 2 problems which I would greatly appreciate some help.
 
1) as you can see Form2 has the extra section-2 and address.
but if Form1 initial instance submitted to Form2 does not have these defined, the field will not even show.
ie. my Form2 is loaded with the name value in Form1, but the Form2 does not display text input for address at all
 
2) if I set any of the field visibility to "false", the value is not sent.
e.g.
in Form1, I have an extra field called "hidden" with a default value set but visibility set to "false"
I can't see this "hidden" field in the xml content, thus, no value is able to be read in my servlet or Form2.
 
I can more or less manipulate to merge Form1 and Form2 xml schema.
But 2nd problem is difficult for me to get around because if the value is not even available, I can do anything about it.
 
Have I missed anything obvious for specifying a hidden field?
 
Any advice is greatly appreciated.
 
Thanks.
 
 
Han Ming

 
 
 
 
 
 
On Wed, Aug 18, 2010 at 11:18 PM, Hank Ratzesberger <[hidden email]> wrote:
Hi Han,

Sorry not much help lately....

I am taking a best guess here. 

The xforms-model-ready event is helpful within the model to process 
data before the form is active for the user.  It occurs only once when 
the form is loaded.  You can call xpl scripts or use insert and xpath 
functions to manipulate the base64 instance into the fr-form-data
(it being declared but empty).

Not that the following will work, cut and paste:

<xf:model id="fr-form-model">

  <xf:action ev:event="xforms-ready">
    <xf:insert nodeset="instance('real-fr-instance')" origin="xxforms:call-xpl('oxf:/some-base64-translator-script.xpl', 'data', instance('input:instance'), 'data')"/>
</xf:action>

  <xf:instance id="real-fr-instance">
    <form xmlns=""/>
  </xf:instance>

</xf:model>

 

--Hank


On Aug 15, 2010, at 8:31 PM, Han Ming Low wrote:

Hi Hank,
 
Thanks for the reply.
 
Ideally, yes, I would like it the 1st form to be submitted to the 2nd form and the 2nd form can use the value submitted from the first form.
 
However, as I was told previously, the 1st form will submit its data as xml in the body and the 2nd form will load it's initial instance as a request parameter "fr-form-data" encoded in base64 encoding, thus, 2nd form would not be able to pick it up without any intervention.
 
So, I wrote a servlet that intercept the request and inserted a new parameter "fr-form-data" with data that is base64 encoded.
However, if that is not required, I can gladly remove this layer.
 
If the xml submit from the 1st form in the body is
<?xml version="1.0" encoding="UTF-8"?>
<form>
        <section-1>
            <name>Test</name>
        </section-1>
</form>
 
then what is the code that I should write in 2nd form to print out the value submitted from the first form?
 
Thanks in advance for any advice.
 
 
 
Han Ming
 
 


 
On Sat, Aug 14, 2010 at 5:16 AM, Hank Ratzesberger <[hidden email]> wrote:
Hi Han Ming,

Will the user arrive at the page from another form?  It could be any page that makes the proper post, 
even a regular html form.  Form Runner will handle this -- it appears you have configured it to do so.

As I understand, FR will handle the post and you don't need to edit the source to add the 
input:instance.

Also in FR, if you enter values into the input fields you create, they become the initial 
values when the form is loaded.  Perhaps that is all that you need?

Regards,
Hank




On Aug 12, 2010, at 8:36 PM, Han Ming Low wrote:

Hi,
 
I'm trying to follow the instruction at
to load the initial instance posted to the form with a base64 encoded parameter "fr-form-data"
I did add in
<property as="xs:boolean" name="oxf.fr.detail.new.accept-post.*.*" value="true"/>
to my properties-local.xml
 
However, I'm not sure how can I load this data.
I try to follow the instruction at
ie.
<xforms:instance id="fr-form-data" src="input:instance"/>
 
Is this correct?
 
When I try to do
<xforms:output ref="instance('fr-form-data')"/>
It always show the path of my form
e.g.
Then, the output will be testTestFormnew
 
<xforms:output ref="instance('fr-form-data')/form/control-1/field-1"/>
Will show empty value
 
What is the correct way of doing it?
 
Thanks.
 
 
Han Ming

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

Hank Ratzesberger
NEES@UCSB
Earth Research Institute
University of California, Santa Barbara
805-893-8042








--
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: [hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Hank Ratzesberger
NEES@UCSB
Earth Research Institute
University of California, Santa Barbara
805-893-8042








--
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: Re: Re: Re: How to load initial instance posted to new form

Hank Ratzesberger-2
Hi Han,

It is true that in Orbeon Forms, if the ref attribute of a control fails to bind, the control will 
not be rendered. There are some options, so let me list them and you can decide 
which fits your scenario.

a) The instances match each other, but one form has controls which are hidden using css: style="display: none" 
b) The submission will not send elements if the bind attribute relevant is false(),
   so you may be able to have matching models, but the submission is limited to 
   the relevant elements.

Well, I thought there were more options, and perhaps there are.

Hope that is some help,
Hank


On Aug 19, 2010, at 8:35 PM, Han Ming Low wrote:

Hi Hank,
 
Sorry for my late reply.
 
Thanks for the tip.
 
I still have to test it out.
In the meantime, I try testing the following.
 
Form1 with the fr-form-instance as follows
<form>
  <section-1>
    <name />
  </section-1>
</form>
 
It will submit to a servlet which will convert the xml body to a fr-form-instance parameter with the xml changed to a base64 encoding, then it will redirect the request to /test/Form2/new
My Form2 has the following fr-form-instance
<form>
  <section-1>
    <name />
  </section-1>
  <section-2>
    <address />
  </section-2>
</form>
 
This time, the data I have keyed in at Form1 is loaded on Form2.
However, I found 2 problems which I would greatly appreciate some help.
 
1) as you can see Form2 has the extra section-2 and address.
but if Form1 initial instance submitted to Form2 does not have these defined, the field will not even show.
ie. my Form2 is loaded with the name value in Form1, but the Form2 does not display text input for address at all
 
2) if I set any of the field visibility to "false", the value is not sent.
e.g.
in Form1, I have an extra field called "hidden" with a default value set but visibility set to "false"
I can't see this "hidden" field in the xml content, thus, no value is able to be read in my servlet or Form2.
 
I can more or less manipulate to merge Form1 and Form2 xml schema.
But 2nd problem is difficult for me to get around because if the value is not even available, I can do anything about it.
 
Have I missed anything obvious for specifying a hidden field?
 
Any advice is greatly appreciated.
 
Thanks.
 
 
Han Ming

 
 
 
 
 
 
On Wed, Aug 18, 2010 at 11:18 PM, Hank Ratzesberger <[hidden email]> wrote:
Hi Han,

Sorry not much help lately....

I am taking a best guess here. 

The xforms-model-ready event is helpful within the model to process 
data before the form is active for the user.  It occurs only once when 
the form is loaded.  You can call xpl scripts or use insert and xpath 
functions to manipulate the base64 instance into the fr-form-data
(it being declared but empty).

Not that the following will work, cut and paste:

<xf:model id="fr-form-model">

  <xf:action ev:event="xforms-ready">
    <xf:insert nodeset="instance('real-fr-instance')" origin="xxforms:call-xpl('oxf:/some-base64-translator-script.xpl', 'data', instance('input:instance'), 'data')"/>
</xf:action>

  <xf:instance id="real-fr-instance">
    <form xmlns=""/>
  </xf:instance>

</xf:model>
 
--Hank


On Aug 15, 2010, at 8:31 PM, Han Ming Low wrote:

Hi Hank,
 
Thanks for the reply.
 
Ideally, yes, I would like it the 1st form to be submitted to the 2nd form and the 2nd form can use the value submitted from the first form.
 
However, as I was told previously, the 1st form will submit its data as xml in the body and the 2nd form will load it's initial instance as a request parameter "fr-form-data" encoded in base64 encoding, thus, 2nd form would not be able to pick it up without any intervention.
 
So, I wrote a servlet that intercept the request and inserted a new parameter "fr-form-data" with data that is base64 encoded.
However, if that is not required, I can gladly remove this layer.
 
If the xml submit from the 1st form in the body is
<?xml version="1.0" encoding="UTF-8"?>
<form>
        <section-1>
            <name>Test</name>
        </section-1>
</form>
 
then what is the code that I should write in 2nd form to print out the value submitted from the first form?
 
Thanks in advance for any advice.
 
 
 
Han Ming
 
 


 
On Sat, Aug 14, 2010 at 5:16 AM, Hank Ratzesberger <[hidden email]> wrote:
Hi Han Ming,

Will the user arrive at the page from another form?  It could be any page that makes the proper post, 
even a regular html form.  Form Runner will handle this -- it appears you have configured it to do so.

As I understand, FR will handle the post and you don't need to edit the source to add the 
input:instance.

Also in FR, if you enter values into the input fields you create, they become the initial 
values when the form is loaded.  Perhaps that is all that you need?

Regards,
Hank




On Aug 12, 2010, at 8:36 PM, Han Ming Low wrote:

Hi,
 
I'm trying to follow the instruction at
to load the initial instance posted to the form with a base64 encoded parameter "fr-form-data"
I did add in
<property as="xs:boolean" name="oxf.fr.detail.new.accept-post.*.*" value="true"/>
to my properties-local.xml
 
However, I'm not sure how can I load this data.
I try to follow the instruction at
ie.
<xforms:instance id="fr-form-data" src="input:instance"/>
 
Is this correct?
 
When I try to do
<xforms:output ref="instance('fr-form-data')"/>
It always show the path of my form
e.g.
Then, the output will be testTestFormnew
 
<xforms:output ref="instance('fr-form-data')/form/control-1/field-1"/>
Will show empty value
 
What is the correct way of doing it?
 
Thanks.
 
 
Han Ming

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

Hank Ratzesberger
NEES@UCSB
Earth Research Institute
University of California, Santa Barbara
805-893-8042








--
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: [hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Hank Ratzesberger
NEES@UCSB
Earth Research Institute
University of California, Santa Barbara
805-893-8042








--
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: [hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Hank Ratzesberger
NEES@UCSB
Earth Research Institute
University of California, Santa Barbara
805-893-8042








--
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