Re: Model inside the view

Posted by Tania Magnenat on
URL: https://discuss.orbeon.com/Model-inside-the-view-tp26923p26925.html

Hi Erik!
Thank you for your help, I read the documentation but this doesn't solve
my problem.

I send you some files that you can test on your computer.

Put the 2 folders (formInsideView and formInsideView2) on the folder
/resources and add to your page-flow.xml the follow lines:

======================================================================

<page id="formInsideView" path-info="/formInsideView"
model="/formInsideView/model-travel.xpl"
xforms="/formInsideView/form-travel.xml"
view="/formInsideView/view-travel.xsl">
        <action when="/*/action='add-travel'">
                        <result page="formInsideView-travel">
                                <xu:update select="/form/id">
                                        1
                                </xu:update>
                        </result>
                </action>
        </page>
        <page id="formInsideView-travel" path-info="/traveltest"
xforms="/formInsideView/travel/form.xml"
view="/formInsideView/travel/view.xhtml"/>
        <page id="formInsideView2" path-info="/formInsideView2"
model="/formInsideView2/model-travel.xpl"
xforms="/formInsideView2/form-travel.xml"
view="/formInsideView2/view-travel.xsl">
        <action when="/*/action='add-travel'">
                        <result page="formInsideView-travel2">
                                <xu:update select="/form/id">
                                        1
                                </xu:update>
                        </result>
                </action>
        </page>
        <page id="formInsideView-travel2" path-info="/traveltest2"
view="/formInsideView2/travel/view.xhtml"/>

====================================================================

Then access the two pages. When you click to "Add Travel" the next page
have to update the id with 1.
In the first page (formInsideView) this works correctly, but in  the
second page (formInsideView2) this doesn't works and I suppose that is
caused by the model inside the view.

Tania

Erik Bruchez wrote:

> Tania,
>
> As pointed out, you will have to remove the "xforms" attribute in your
> page flow, as keeping it triggers the XForms Classic engine:
>
>   http://www.orbeon.com/ops/doc/home-faq#xforms-classic-or-ng
>
> Once that is done, you should tackle the next problem ;-)
>
> I assume you want to update an XForms instance. I suggest, if not
> already done, that you have a look at the following sections of the
> documentation:
>
>   http://www.orbeon.com/ops/doc/reference-page-flow#xml-submission
>
> http://www.orbeon.com/ops/doc/reference-xforms-ng#xforms-instance-initialization 
>
>
> -Erik
>
> Tania Magnenat wrote:
>  > Hi everybody!
>  >
>  > How to update (in the page flow) a xforms model when the model is inside
>  > the view?
>  > If the model is separated from the view, I have no problem (the xforms
>  > model is updated correctly with data from the previous model), but when
>  > the model is inside the view it doesn't works.
>  >
>  > Page flow example where the update works:
>  > =========================================
>  >
>  > <page id="travel" path-info="/travel" model="model-travel.xpl"
>  > xforms="form-travel.xml" view="view-travel.xsl">
>  >     <action when="/*/action='add-travel'">
>  >         <result page="add-travel">
>  >             <xu:update select="/form/id">
>  >                 <xu:value-of
>  > select="document('input:instance')/*/document/ProjectID"/>
>  >             </xu:update>
>  >         </result>
>  >     </action>
>  > </page>
>  > <page id="add-travel" path-info="/add-travel" xforms="/travel/form.xml"
>  > view="/travel/view.xhtml"/>
>  >
>  >
>  > Page flow example where the update doesn't works:
>  > ================================================
>  >
>  > <page id="travel" path-info="/travel" model="model-travel.xpl"
>  > xforms="form-travel.xml" view="view-travel.xsl">
>  >     <action when="/*/action='add-travel'">
>  >         <result page="add-travel">
>  >             <xu:update select="/form/id">
>  >                 <xu:value-of
>  > select="document('input:instance')/*/document/ProjectID"/>
>  >             </xu:update>
>  >         </result>
>  >     </action>
>  > </page>
>  > <page id="add-travel" path-info="/add-travel"
> view="/travel/view.xhtml"/>
>  >
>  >
>  > Thanks in advance!
>  >
>  > Tania
>  >
>  > P.S: I'm using OPS 3.0 beta 4
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

formInsideView2.zip (9K) Download Attachment
formInsideView.zip (9K) Download Attachment