Creating Contextual Forms

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

Creating Contextual Forms

tom.rudick
Hi All,

Is there an easy way to create contextual forms with Orbeon? Meaning, suppose I have the following model where book can appear any number of times:
<books>
  <book>
    <title />
    <author />
  </book>
</books>

So, I create a xforms:repeat and have a list of books. Then, when a user selects a book, a form would appear bound to the title and author of the selected book. Could this be accomplished with an xforms:switch? The only caveat is that the book list must remain on screen while the contextual form is present.

I am currently using a model to keep track of state data, a relevant binding, and a group to hide and show the form. However, this seems a bit hacky. Is there an easier way?

Thanks in advance,
-Tom
Reply | Threaded
Open this post in threaded view
|

Re: Creating Contextual Forms

Erik Bruchez
Administrator
Tom,

Where is that sub-form defined, and where does its data come from?

-Erik

On Dec 4, 2008, at 6:04 PM, tom.rudick wrote:

>
> Hi All,
>
> Is there an easy way to create contextual forms with Orbeon? Meaning,
> suppose I have the following model where book can appear any number of
> times:
> <books>
>  <book>
>    <title />
>    <author />
>  </book>
> </books>
>
> So, I create a xforms:repeat and have a list of books. Then, when a  
> user
> selects a book, a form would appear bound to the title and author of  
> the
> selected book. Could this be accomplished with an xforms:switch? The  
> only
> caveat is that the book list must remain on screen while the  
> contextual form
> is present.
>
> I am currently using a model to keep track of state data, a relevant
> binding, and a group to hide and show the form. However, this seems  
> a bit
> hacky. Is there an easier way?
>
> Thanks in advance,
> -Tom
> --
> View this message in context: http://www.nabble.com/Creating-Contextual-Forms-tp20835626p20835626.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.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
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Creating Contextual Forms

tom.rudick
Hi Eric,

The sub-form would be, ideally, in another div away from the selection form. So for the XML instance I gave earlier, when a user clicked a book title from the list, the subform would be able to edit the title and author of that book. This data comes from the same model as the selection list.

Erik Bruchez wrote
Where is that sub-form defined, and where does its data come from?
Reply | Threaded
Open this post in threaded view
|

Re: Creating Contextual Forms

fl.schmitt(ops-users)
In reply to this post by tom.rudick
Tom,

> So, I create a xforms:repeat and have a list of books. Then, when a user
> selects a book, a form would appear bound to the title and author of the
> selected book. Could this be accomplished with an xforms:switch? The only
> caveat is that the book list must remain on screen while the contextual form
> is present.

one approach could be to add a "control instance" that points to one of
the book elements using its position. a selection trigger puts the
current position (using the index() function (*)) there.

Now, either a xforms:group "checks" the control instance and displays
the selected book, or a xforms:switch / xforms:case is toggled by the
selection trigger. Personally, i would prefer the xforms:group -
switch/case may be better suited to toggle between two sets of controls,
whereas xforms:group is ideal to display or hide a certain set of controls.

I've attached a simple sandbox example showing a list of book items and
a little form to edit the selected item. The input form controls are
shown / hidden using xforms:group.

hth
florian

(*) i wasn't able to get the position written correctly using position()
or count(preceding-sibling::*) - only index() worked for me.


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

contextForm.xhtml (3K) Download Attachment