I'm using an <xxforms:dialog> to present a select of controlled terms for a <xforms:input> . I show the dialog on a DOMFocusIn event on the <xforms:input>, passing the <input>'s context in the event:
<xforms:input...> <xxforms:show dialog="name-authorities-dialog" ev:event="DOMFocusIn"> <xxforms:context name="control" select="."/> </xxforms:show> </xforms:input> Then in the dialog I set a variable with the passed context on the xxforms-dialog-open event: <xxforms:variable name="control" select="event('control')" ev:event="xxforms-dialog-open"/> The source instance context is visible through this variable within the dialog's xxforms-dialog-open handlers, but not anywhere else in the dialog. I'd like to update the source instance from the dialog on its xxforms-dialog-close handler, but the $control variable is empty at that point. I'm running the nightly build from dev-post-3.7.1.201004010300. Any ideas? Should I be approaching this differently? Thanks very much, Bill Parod Northwestern University |
Administrator
|
Bill,
This is happening most likely because the variable is not evaluated just once when the dialog opens, but is reevaluated when bindings are reevaluated (just like the ref in <xforms:input ref="...">). So when the dialog opens, you'll have to store that value somewhere. If you already have a global instance that works well for that, then you're all good. Otherwise you can create a new one. Note that you can also have an <xforms:model> in the "view", just next (or inside) the dialog. Semantically it will be as if the model was declared at the top level (you'll have to use the model attribute), but this will allow you to keep all your code for that dialog local. Alex On Sun, Apr 11, 2010 at 1:25 PM, Bill Parod <[hidden email]> wrote: > > I'm using an <xxforms:dialog> to present a select of controlled terms for a > <xforms:input> . I show the dialog on a DOMFocusIn event on the > <xforms:input>, passing the <input>'s context in the event: > > <xforms:input...> > <xxforms:show dialog="name-authorities-dialog" ev:event="DOMFocusIn"> > <xxforms:context name="control" select="."/> > </xxforms:show> > </xforms:input> > > Then in the dialog I set a variable with the passed context on the > xxforms-dialog-open event: > > <xxforms:variable name="control" select="event('control')" > ev:event="xxforms-dialog-open"/> > > The source instance context is visible through this variable within the > dialog's xxforms-dialog-open handlers, but not anywhere else in the dialog. > I'd like to update the source instance from the dialog on its > xxforms-dialog-close handler, but the $control variable is empty at that > point. > > I'm running the nightly build from dev-post-3.7.1.201004010300. > > Any ideas? Should I be approaching this differently? > > Thanks very much, > Bill Parod > Northwestern University > > -- > View this message in context: http://n4.nabble.com/context-variable-outside-xxforms-dialog-open-tp1836398p1836398.html > Sent from the Orbeon Forms (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, open-source, for the Enterprise - http://www.orbeon.com/ My Twitter: http://twitter.com/avernet -- 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Alex,
Thanks very much for your helpful reply. I'm able to store the value obtained from the context passed in the <xxforms:show dialog...> and store it in a model in the dialog for use in the dialog. I'm not sure though how to store values back into the source model from the dialog as I've lost the original context at that point. Is there a way to store the context rather than its value in a local model? As an alternative, I wondered if I should try to use events - target the original <xforms:input> (who's DOMDocusIn invoked the dialog) from the dialog with a new value. Thanks again, Bill On Apr 12, 2010, at 7:13 PM, Alessandro Vernet wrote:
Bill Parod Library Technology Division - Enterprise Systems Northwestern University Library 847 491 5368 -- 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 |
Administrator
|
Bill,
So you are saying that you'd like to move information from the dialog's model to some other instance, maybe when the dialog closes. Is that right? This is harder, as you would need to store a "pointer" to a node, i.e. an XPath expression. Whoever opens the dialog could, instead of passing the node to which the data needs to stored, pass an XPath expression (as a string) to that node. This is what you would store, and you can use saxon:evaluate() to get the node based on the XPath expression. But I feel that this is a case best handled in XBL. See for instance the code of the spell checker component which does something like that: it shows a dialog and puts back in the node the value of the text after it has been spell checked. You can see the code here: http://github.com/orbeon/orbeon-forms/blob/master/src/resources-packaged/xbl/orbeon/spell-checker/spell-checker.xbl Alex On Mon, Apr 12, 2010 at 6:27 PM, Bill Parod <[hidden email]> wrote: > Alex, > Thanks very much for your helpful reply. > I'm able to store the value obtained from the context passed in the > <xxforms:show dialog...> and store it in a model in the dialog for use in > the dialog. > I'm not sure though how to store values back into the source model from the > dialog as I've lost the original context at that point. Is there a way to > store the context rather than its value in a local model? > As an alternative, I wondered if I should try to use events - target the > original <xforms:input> (who's DOMDocusIn invoked the dialog) from the > dialog with a new value. > Thanks again, > Bill > > > On Apr 12, 2010, at 7:13 PM, Alessandro Vernet wrote: > > Bill, > > This is happening most likely because the variable is not evaluated > just once when the dialog opens, but is reevaluated when bindings are > reevaluated (just like the ref in <xforms:input ref="...">). So when > the dialog opens, you'll have to store that value somewhere. If you > already have a global instance that works well for that, then you're > all good. Otherwise you can create a new one. > > Note that you can also have an <xforms:model> in the "view", just next > (or inside) the dialog. Semantically it will be as if the model was > declared at the top level (you'll have to use the model attribute), > but this will allow you to keep all your code for that dialog local. > > Alex > > > On Sun, Apr 11, 2010 at 1:25 PM, Bill Parod <[hidden email]> > wrote: > > I'm using an <xxforms:dialog> to present a select of controlled terms for a > > <xforms:input> . I show the dialog on a DOMFocusIn event on the > > <xforms:input>, passing the <input>'s context in the event: > > <xforms:input...> > > <xxforms:show dialog="name-authorities-dialog" ev:event="DOMFocusIn"> > > <xxforms:context name="control" select="."/> > > </xxforms:show> > > </xforms:input> > > Then in the dialog I set a variable with the passed context on the > > xxforms-dialog-open event: > > <xxforms:variable name="control" select="event('control')" > > ev:event="xxforms-dialog-open"/> > > The source instance context is visible through this variable within the > > dialog's xxforms-dialog-open handlers, but not anywhere else in the dialog. > > I'd like to update the source instance from the dialog on its > > xxforms-dialog-close handler, but the $control variable is empty at that > > point. > > I'm running the nightly build from dev-post-3.7.1.201004010300. > > Any ideas? Should I be approaching this differently? > > Thanks very much, > > Bill Parod > > Northwestern University > > -- > > View this message in context: > http://n4.nabble.com/context-variable-outside-xxforms-dialog-open-tp1836398p1836398.html > > Sent from the Orbeon Forms (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, open-source, for the Enterprise - > http://www.orbeon.com/ > My Twitter: http://twitter.com/avernet > > -- > 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 > > Bill Parod > > Library Technology Division - Enterprise Systems > Northwestern University Library > [hidden email] > 847 491 5368 > > > > > -- > 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, open-source, for the Enterprise - http://www.orbeon.com/ My Twitter: http://twitter.com/avernet -- 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
On Apr 16, 2010, at 8:04 PM, Alessandro Vernet wrote:
Yes, that's correct.
That's sort of what I'm doing now, saving enough context information on dialog-open into the dialog's local instance to form an XPath to update the main instance on dialog close. Thanks for confirming that the context passed on dialog open is not available on dialog close. I wasn't sure if I was doing something wrong in losing it.
Bill
Bill Parod Library Technology Division - Enterprise Systems Northwestern University Library 847 491 5368 -- 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 |
Administrator
|
Bill,
On Sat, Apr 17, 2010 at 7:24 AM, Bill Parod <[hidden email]> wrote: > http://github.com/orbeon/orbeon-forms/blob/master/src/resources-packaged/xbl/orbeon/spell-checker/spell-checker.xbl > > > Fantastic! Thank you very much. I'l study this example. You're very welcome. XBL might look complicated at first (a whole new set of things to learn!), but I think you will find it quite powerful if need that sort of things, adding another layer of indirection on top of XForms. Alex -- Orbeon Forms - Web forms, open-source, for the Enterprise - http://www.orbeon.com/ My Twitter: http://twitter.com/avernet -- 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |