Anyone,
I'm trying to blank out the element values in a template instance, after the template instance is inserted into another instance. The insertion works, but I cannot figure out how to clear the fields. Here's the relevant snippet: <xforms:trigger>As you can see, I've tried binding with a complete path ("name") and a relative path ("age"). I even tried adding ev:event="DOMActivate" to the setvalue element at one point, but it just does nothing. What's the right way to do this? How do you debug something like this? Thanks, -Jim -- 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 |
Indeed, the value attribute is an xpath statement, so it has to point to something. I use this in my forms so I can "clear" instances: <xforms:instance id="null-instance"> <null xmlns=""/> </xforms:instance> <xforms:setvalue ref="instance('my-instance')/my-xpath" value="instance('null-instance')/"/> and notice that it is the ref attribute and not the bind attribute which is the "target." --Hank On May 19, 2008, at 11:04 AM, Jim Logan wrote: > Anyone, > > I'm trying to blank out the element values in a template instance, > after the template instance is inserted into another instance. The > insertion works, but I cannot figure out how to clear the fields. > Here's the relevant snippet: > <xforms:trigger> > <xforms:label>Add</xforms:label> > <xforms:insert ev:event="DOMActivate" > nodeset="/person/pets/pet" > at="1" position="before" > origin="instance('pet-template')" /> > <xforms:setvalue bind="instance > ('pet-template')/name" value=""/> > <xforms:setvalue bind="age" value=""/> > </xforms:trigger> > > As you can see, I've tried binding with a complete path ("name") > and a relative path ("age"). I even tried adding > ev:event="DOMActivate" to the setvalue element at one point, but it > just does nothing. What's the right way to do this? How do you > debug something like this? > > Thanks, > -Jim > > > > -- > 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 NEES@UCSB Institute for Crustal Studies, University of California, Santa Barbara 805-893-8042 -- 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 |
Hank Ratzesberger wrote:
> > Indeed, the value attribute is an xpath statement, so > it has to point to something. I use this in my > forms so I can "clear" instances: > > <xforms:instance id="null-instance"> > <null xmlns=""/> > </xforms:instance> > > > <xforms:setvalue ref="instance('my-instance')/my-xpath" > value="instance('null-instance')/"/> > > and notice that it is the ref attribute and not the > bind attribute which is the "target." Earlier I changed to using an xforms:action and then I cleaned up a bunch of mistakes you pointed out: <xforms:group ref="instance('pet-template')"> <tr> <td> <xforms:input ref="name"/> </td> <td> <xforms:input ref="age"/> </td> <td> <xforms:trigger> <xforms:label>Add</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:insert nodeset="/person/pets/pet" at="1" position="before" origin="instance('pet-template')" /> <xforms:setvalue ref="instance('pet-template')/name">test</xforms:setvalue> <xforms:setvalue ref="age"/> </xforms:action> </xforms:trigger> </td> </tr> </xforms:group> I'm hoping I can get this to work with some subtle fix so I can learn what I'm doing wrong before I change everything to use a null instance. Any idea what's wrong with the above snippet, given the following instance? <xforms:instance id="pet-template"> <pet xmlns="" action="added"> <name/> <age/> </pet> </xforms:instance> Thanks, -Jim > > > On May 19, 2008, at 11:04 AM, Jim Logan wrote: > >> Anyone, >> >> I'm trying to blank out the element values in a template instance, >> after the template instance is inserted into another instance. The >> insertion works, but I cannot figure out how to clear the fields. >> Here's the relevant snippet: >> <xforms:trigger> >> <xforms:label>Add</xforms:label> >> <xforms:insert ev:event="DOMActivate" >> nodeset="/person/pets/pet" >> at="1" position="before" >> origin="instance('pet-template')" /> >> <xforms:setvalue >> bind="instance('pet-template')/name" value=""/> >> <xforms:setvalue bind="age" value=""/> >> </xforms:trigger> >> >> As you can see, I've tried binding with a complete path ("name") and >> a relative path ("age"). I even tried adding ev:event="DOMActivate" >> to the setvalue element at one point, but it just does nothing. >> What's the right way to do this? How do you debug something like this? >> >> Thanks, >> -Jim >> >> >> >> -- >> 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 > > Hank Ratzesberger > NEES@UCSB > Institute for Crustal Studies, > University of California, Santa Barbara > 805-893-8042 > > > > > -- 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 |
Hank,
Sorry, I wasted your time with a stupid error on my part. After I got that path thing working, I shuffled files around, and I was editing the wrong file! Argh! Thanks, -Jim -- 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 |
In reply to this post by Jim Logan-3
Hank,
I spoke too soon. The setvalues work, but the insert no longer works (see below). The insert worked until I put it inside the action (and moved the event from the insert to the action). The XForms spec says that all the actions should all happen in the specified order. Any ideas? Thanks, -Jim Jim Logan wrote: > Hank, > > Earlier I changed to using an xforms:action and then I cleaned up a > bunch of mistakes you pointed out: > > <xforms:group ref="instance('pet-template')"> > <tr> > <td> > <xforms:input ref="name"/> > </td> > <td> > <xforms:input ref="age"/> > </td> > <td> > <xforms:trigger> > <xforms:label>Add</xforms:label> > <xforms:action ev:event="DOMActivate"> > <xforms:insert > nodeset="/person/pets/pet" > at="1" position="before" > origin="instance('pet-template')" /> > <xforms:setvalue > ref="instance('pet-template')/name">test</xforms:setvalue> > <xforms:setvalue ref="age"/> > </xforms:action> > </xforms:trigger> > </td> > </tr> > </xforms:group> > > I'm hoping I can get this to work with some subtle fix so I can learn > what I'm doing wrong before I change everything to use a null > instance. Any idea what's wrong with the above snippet, given the > following instance? > > <xforms:instance id="pet-template"> > <pet xmlns="" action="added"> > <name/> > <age/> > </pet> > </xforms:instance> > > Thanks, > -Jim > >> >> >> On May 19, 2008, at 11:04 AM, Jim Logan wrote: >> >>> Anyone, >>> >>> I'm trying to blank out the element values in a template instance, >>> after the template instance is inserted into another instance. The >>> insertion works, but I cannot figure out how to clear the fields. >>> Here's the relevant snippet: >>> <xforms:trigger> >>> <xforms:label>Add</xforms:label> >>> <xforms:insert ev:event="DOMActivate" >>> nodeset="/person/pets/pet" >>> at="1" position="before" >>> origin="instance('pet-template')" /> >>> <xforms:setvalue >>> bind="instance('pet-template')/name" value=""/> >>> <xforms:setvalue bind="age" value=""/> >>> </xforms:trigger> >>> >>> As you can see, I've tried binding with a complete path ("name") and >>> a relative path ("age"). I even tried adding ev:event="DOMActivate" >>> to the setvalue element at one point, but it just does nothing. >>> What's the right way to do this? How do you debug something like this? >>> >>> Thanks, >>> -Jim >>> >>> >>> >>> -- >>> 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 >> >> Hank Ratzesberger >> NEES@UCSB >> Institute for Crustal Studies, >> University of California, Santa Barbara >> 805-893-8042 >> >> >> >> >> > -- 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 |
Jim Logan wrote:
> Hank, > > I spoke too soon. The setvalues work, but the insert no longer works > (see below). The insert worked until I put it inside the action (and > moved the event from the insert to the action). The XForms spec says > that all the actions should all happen in the specified order. Any ideas? > > Thanks, > -Jim Ah, diffing told me why. Somehow I removed the context attribute. Adding it back made it start working again. -Jim -- 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
|
In reply to this post by Jim Logan-3
Try either of:
<xforms:setvalue bind="instance('pet-template')/name" value="''"/> <xforms:setvalue bind="instance('pet-template')/name"/> -Erik On May 19, 2008, at 11:04 AM, Jim Logan wrote: > Anyone, > > I'm trying to blank out the element values in a template instance, > after the template instance is inserted into another instance. The > insertion works, but I cannot figure out how to clear the fields. > Here's the relevant snippet: > <xforms:trigger> > <xforms:label>Add</xforms:label> > <xforms:insert ev:event="DOMActivate" > nodeset="/person/pets/pet" > at="1" position="before" > origin="instance('pet-template')" /> > <xforms:setvalue bind="instance('pet- > template')/name" value=""/> > <xforms:setvalue bind="age" value=""/> > </xforms:trigger> > > As you can see, I've tried binding with a complete path ("name") and > a relative path ("age"). I even tried adding ev:event="DOMActivate" > to the setvalue element at one point, but it just does nothing. > What's the right way to do this? How do you debug something like this? > > Thanks, > -Jim > > > > -- > 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 |
In reply to this post by Jim Logan-3
On May 19, 2008, at 11:30 AM, Jim Logan wrote: > <xforms:setvalue ref="age"/> > And it looks like this is a quicker way to use setvalue -- empty content. --Hank >> Hank Ratzesberger NEES@UCSB Institute for Crustal Studies, University of California, Santa Barbara 805-893-8042 -- 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 |