Add an element and delete it's child

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

Add an element and delete it's child

Daniel E. Renfer
Hello,

I am trying to create a form where, if a given element is missing from
my instance, I add it. The only thing is, in my template instance, the
element I'm adding has a child element. (which is used as the template
for adding more of that child.)

I tried to create an action that will add the element I'm looking for,
and then immediately remove it's child. It's not doing it. Is there a
way to delete a sub-element from an element that has just been added,
or better yet, to add that element but not it's child?

I suppose as a workaround, I could have two templates (one with and
one without) but I'd that seems like a waste as I'd either have to
have two instances, or have my instance be invalid as per my schema.

I've attached a minimal testcase that shows what I'm doing.

--
Daniel E. Renfer
http://kronkltd.net/


--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

test.xhtml (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Add an element and delete it's child

Daniel E. Renfer
On 6/17/07, Daniel E. Renfer <[hidden email]> wrote:

> Hello,
>
> I am trying to create a form where, if a given element is missing from
> my instance, I add it. The only thing is, in my template instance, the
> element I'm adding has a child element. (which is used as the template
> for adding more of that child.)
>
> I tried to create an action that will add the element I'm looking for,
> and then immediately remove it's child. It's not doing it. Is there a
> way to delete a sub-element from an element that has just been added,
> or better yet, to add that element but not it's child?
>
> I suppose as a workaround, I could have two templates (one with and
> one without) but I'd that seems like a waste as I'd either have to
> have two instances, or have my instance be invalid as per my schema.
>
> I've attached a minimal testcase that shows what I'm doing.
Okay, right before I uploaded my testcase, I changed the @ref on my
second xf:group to find out why I was seeing the label for that group
even though it shouldn't have been there. I thought I tested it, but
it appears the sandbox was using cached information, because I screwed
up the binding on my repeat.

Attached is the corrected testcase. (I also added the instance inspector)

--
Daniel E. Renfer
http://kronkltd.net/


--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

test.xhtml (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: Add an element and delete it's child

Alessandro Vernet
Administrator
Daniel,

On 6/18/07, Daniel E. Renfer <[hidden email]> wrote:
> Okay, right before I uploaded my testcase, I changed the @ref on my
> second xf:group to find out why I was seeing the label for that group
> even though it shouldn't have been there. I thought I tested it, but
> it appears the sandbox was using cached information, because I screwed
> up the binding on my repeat.

This is a tricky case: when you do the first insert, since the group
in which all of this is running has ref=".[not(myc:chat)], after the
insert, there is no more context, so the delete doesn't do anything
because there is no context to run it into.

I changed the ref="..." expression on the group to avoid this problem,
but still have the same behavior. Also I fixed the syntax of the
delete to use just nodeset="...". Your updated example is attached.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

test.xhtml (3K) Download Attachment