Direct to specific view depending on model

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

Direct to specific view depending on model

John Unwin
Hi,

I want to have a <page...> defined in my page flow so that different
pages are displayed depending on the result of the page's. E.g. if the
model's result says "form-1" then I want to display the form-1-detail view.

I want to do something like:

    <page id="task-detail" path-info="/xforms/hr/task-detail"
        model="get-form-detail-model.xpl"
        view="other-detail-view.xhtml">
        <action when="/form-model/form-name = 'form-1' ">
            <result id="form-1-detail" page="form-1-view"/>
        </action>
         <action when="/form-model/form-name = 'form-2' ">
            <result id="form-2-detail" page="form-2-view"/>
        </action>
    </page>

...where the get-form-detail-model.xpl gets (from a web-service) data in
several varieties, each with a matching view. Deciding the view to
direct to depends on the result of the model pipeline (and the web
service called therein).

This doesn't work because when an <action...> directs to a page (i.e.
<action... page="...">), the model of the surrounding <page...> does not
execute (as explained in the page flow documentation - section 4.2.4).
And if the model doesn't execute, the action doesn't have the
information to use for the decision anyway.

Is there a way to use the result of the model pipeline to decide which
view to use? And direct control to that view? And pass the result of the
pipeline to that view?

Cheers
John




--
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
Reply | Threaded
Open this post in threaded view
|

Re: Direct to specific view depending on model

Erik Bruchez
Administrator
John,

 > I want to have a <page...> defined in my page flow so that different
 > pages are displayed depending on the result of the page's. E.g. if the
 > model's result says "form-1" then I want to display the form-1-detail
view.
 >
 > I want to do something like:
 >
 >    <page id="task-detail" path-info="/xforms/hr/task-detail"
 >        model="get-form-detail-model.xpl"
 >        view="other-detail-view.xhtml">
 >        <action when="/form-model/form-name = 'form-1' ">
 >            <result id="form-1-detail" page="form-1-view"/>
 >        </action>
 >         <action when="/form-model/form-name = 'form-2' ">
 >            <result id="form-2-detail" page="form-2-view"/>
 >        </action>
 >    </page>
 >
 > ...where the get-form-detail-model.xpl gets (from a web-service) data in
 > several varieties, each with a matching view. Deciding the view to
 > direct to depends on the result of the model pipeline (and the web
 > service called therein).
 >
 > This doesn't work because when an <action...> directs to a page (i.e.
 > <action... page="...">), the model of the surrounding <page...> does not
 > execute (as explained in the page flow documentation - section 4.2.4).
 > And if the model doesn't execute, the action doesn't have the
 > information to use for the decision anyway.
 >
 > Is there a way to use the result of the model pipeline to decide which
 > view to use? And direct control to that view? And pass the result of the
 > pipeline to that view?

Not in the page flow.

You could write your view as an XPL file, and there decide to load
different views depending on the current requested URL. This is course
would be fairly heavy unless you just have a few different views.

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws