dynamic population of form based on user input

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

dynamic population of form based on user input

Smith, Donald

Let’s say on page 1 I give the user the ability to pick between A and B. Depending on which one the user picks, the form that loads for page 2 will have different content at some point, giving the user the ability to choose between different options that are appropriate to A or B, as the case may be.

 

How is this accomplished? Is there an example of this in the demos?

 

Thanks,

 

Don



--
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: dynamic population of form based on user input

Erik Bruchez
Administrator
Smith, Donald wrote:

 > Let's say on page 1 I give the user the ability to pick between A
 > and B.  Depending on which one the user picks, the form that loads
 > for page 2 will have different content at some point, giving the
 > user the ability to choose between different options that are
 > appropriate to A or B, as the case may be.

 > How is this accomplished? Is there an example of this in the demos?

Don,

Your description is very generic, so I will answer in generic terms,
which may or may not be useful to you. I see a few questions:

1. What mechanisms do you use to navigate from page 1 to page 2.

    1. You can use a direct link (<a href="..."> or <xforms:load
       resource="...">) if your destination page is static.

    2. You can use a dynamic link <xforms:load ref="..."> if your
       destination is dynamic, and compute the destination URL with
       <xforms:bind>

    3. You can perform an XForms submission with <xforms:submission>
       and <xforms:submit> or <xforms:send>.

2. How do you pass information between two pages.

    1. Page 1 can submit an XForms instance (with POST) to page 2's
       URL. The submitted instance is available in page actions, page
       models and page views from the "instance" input.

       In your page flow, page 2's page model can extract information
       from that submitted instance, or you can include the submitted
       instance directly in page 2's page view (which problably uses
       XForms), either with XSLT or XInclude. See this part of the doc:

 
http://www.orbeon.com/ops/doc/reference-xforms-ng#xforms-instance-initialization

       Alternatively, you can perform that submission to page 1's URL,
       and construct your page flow so as to navigate to page 2 by
       passing the submitted XForms instance (with <action> and <result
       page="">).

    2. If the information you want to pass is not too large, you can
       also submit to page 2's URL using "GET". In this case, you need
       the PFC's help to extract data from the URL to store it into an
       XML document, which you can then use as above to construct page
       2's view:

         http://www.orbeon.com/ops/doc/reference-page-flow#url-extraction

       Again, you end up with the submitted instance as an XML document
       available from PFC components on the "instance" input.

    3. You can also manually construct a URL using <xforms:load
       ref=""/> and <xforms:bind>.

3. Conditionally display controls, etc. in page 2 based on the data
    submitted by page 1.

    To achieve this, you typically use "relevant" model item
    properties, which can apply to individual controls but also to
    entire groups (<xforms:group>).

In the above, I assume that you have only one page 2. But if page 2 is
going to be very different depending on the data entered on page 1,
you can also create to different page 2s, say, page 2a and page
2b. Then your XForms submission, XForms loads, or PFC redirections
have to make a decision as to whether to navigate to page 2a or page
2b.

I am not sure there is a perfect example illustrating all of this, but
look at "BizDoc NG" and the (still incomplete) "Blog" examples. We are
working on a new and improved Forms example which will show that kind
of things better.

-Erik



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