answer is to use xxforms:evaluate and xxforms:variable <xxforms:variable name="node-path" select="replace(instance('instance-ont')/node-path, '\[\d*\]$', '')"/> <xforms:setvalue ref="xxforms:evaluate(concat('instance(''instance-report'')', $node-path, $node-identifier-index ))" value="context()/label"/> ________________________________________ From: tgra [[hidden email]] Sent: 14 April 2011 13:28 To: [hidden email] Subject: [ops-users] contextual menu using xxforms:dialog - how to update specific instance element The following orbeon wiki page describes a contextual menu using xxforms:dialog. http://wiki.orbeon.com/forms/how-to/view/contextual-menu I would like to use this in an input form, where, further to a selection in the dialog menu, an element in the main instance is updated with the selected value. This can be achieved using xforms:setvalue with a **static** @ref value, e.g. However, the input form is dynamically generated, therefore the path to the relevant element is variable. When clicking on the dialog link, I can update a selection instance with the path to the element, but cannot see how to pass this path as a variable to the @ref attribute of My questions are: -- Is it possible to use an xxforms:variable in the @ref statement? -- If not, is there an alternative approach? -- View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/contextual-menu-using-xxforms-dialog-how-to-update-specific-instance-element-tp3449495p3449495.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 |
Administrator
|
Exactly. A few comments though:
1. In the case where you're passing a "node" to a dialog: 1.1. Instead of passing the path to the dialog through an instance, you can pass it in an event context. Then of course the dialog might still have to store the value in an instance, but this can make the contract between the dialog and user of the dialog clearer. As example, this sends an event to a dialog: <xforms:dispatch target="fr-dialog-editor-dialog" name="fr-edit"> <xxforms:context name="fr-readonly" select="$readonly"/> <xxforms:context name="fr-text" select="$binding"/> </xforms:dispatch> Then inside the event handler (placed inside the <xxforms:dialog>), you store the values and open the dialog: <xforms:action ev:event="fr-edit"> <xforms:setvalue ref="readonly" value="event('fr-readonly')"/> <xforms:setvalue ref="text" value="event('fr-text')"/> <xxforms:show dialog="fr-dialog-editor-dialog"/> </xforms:action> 1.2. Maybe this is already what you are doing, but you can use saxon:path() to generate the XPaht expression pointing to a node. See: http://www.saxonica.com/documentation9.1/extensions/functions/path.html 2. Instead of passing an XPath expression to a node, you could pass the id of a control. Then when the dialog has done its thing and wants to pass back a value, instead of writing that value to an instance, it can dispatch an event back to the id that opened the dialog, passing in the context information the data it would have stored in the instance. This is what is done in the following example (ignore the XBL elements and attributes—the logic would be just the same outside of the XBL): https://github.com/orbeon/orbeon-forms/blob/master/src/resources-packaged/xbl/orbeon/dialog-editor/dialog-editor.xbl Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |