Hi,
I've been trying to get my head around this problem and I'm hoping maybe someone else has solved a similar problem and can offer some guidance: In my model, supposing I have an instance like this: <xf:instance xmlns="" id="an-event"> <data> <username /> <department /> </data> </xf:instance> What I'd really like to be able to do is get those values (username and department) from another instance that I've loaded by the time the form is ready (xforms-ready); so essentially I'm thinking about something like this: <username>{instance('user-credentials')//username}</username> <department>{instance('user-credentials')//department}</department> Obviously if I do this, or if I use something like <department><xf:output ref="instance('user-credentials')//department" /></department> I literally get that text inside the instance - which I guess is precisely what should be expected... I've been thinking about how to best fill those values and I've thought about maybe using events to do this (e.g. xforms-ready combined with xf:setvalue or even looking at checking out xxforms:setvalue), or maybe even updating to the latest nightly build and trying the xxforms:iterate feature... ... I've even thought of setting the values right at a point when a submission event occurs but so far I haven't managed to come up with anything that works well... Is there a good 'recommended' way to do such a thing relatively easily? Can anyone offer any suggestions? Thanks so much, A |
In case anyone is interested, I've found an immediate solution:
Firstly, the instance should look something like this (so the tags you want to set the values for actually close): <xf:instance xmlns="" id="an-event"> <data> <username></username> <department></department> </data> </xf:instance> Then later on in the model: <xf:action ev:event="xforms-ready"> <xf:setvalue ref="instance('an-event')//username" value="instance('the-source-instance')//username" ev:event="DOMActivate" /> <xf:setvalue ref="instance('an-event')//department" value="instance('the-source-instance')//department" ev:event="DOMActivate" /> </xf:action> Once I'd ensured that the instance had tags with both open and closing blocks, everything started working. Hope this is useful to someone else. |
Administrator
|
You can also write <username/> and <department/>. Shorter, and
absolutely identical. -Erik On May 20, 2008, at 6:58 AM, Alex Bleasdale wrote: > > In case anyone is interested, I've found an immediate solution: > > Firstly, the instance should look something like this (so the tags > you want > to set the values for actually close): > > > <xf:instance xmlns="" id="an-event"> > <data> > <username></username> > <department></department> > </data> > </xf:instance> > > Then later on in the model: > > <xf:action ev:event="xforms-ready"> > <xf:setvalue ref="instance('an-event')//username" > value="instance('the-source-instance')//username" > ev:event="DOMActivate" /> > <xf:setvalue ref="instance('an-event')//department" > value="instance('the-source-instance')//department" > ev:event="DOMActivate" > /> > </xf:action> > > Once I'd ensured that the instance had tags with both open and closing > blocks, everything started working. Hope this is useful to someone > else. > > -- > View this message in context: http://www.nabble.com/Setting-one-xf%3Ainstance-with-values-from-another-xf%3Ainstance-tp17329245p17341016.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 |
> You can also write <username/> and <department/>. Shorter, and
> absolutely identical. That's odd; I tried that and the setvalue didn't seem to work at all.. A |
Administrator
|
> That's odd; I tried that and the setvalue didn't seem to work at all..
Yes, odd indeed, because I could bet a lot of money on this ;-) -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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |