trying to understand context when deleting nodes inside nested repeats

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

trying to understand context when deleting nodes inside nested repeats

Philip.Cantin
Hi All,

I have two sample XForms documents I have been using for testing within Orbeon. With one of them, "delete_working.xhtml," you can add several fields, press the "Delete" button by that field, and it will delete the correct field. With the other, "delete_broken.xhtml," if you add several fields by clicking the "+" icon, then press the "x" icon beside one of the fields, it will NOT delete that field, but rather the last one in the list.

I have been trying to find out for a while now what makes the other one succeed and what makes the other one fail. I've tried adding things to the broken one (such as xxforms:context() within certain attributes) as well as removing things from the working one (such as <div>s and <xf:group>s), but all to no avail. Also, I notice that in the broken one, updates to fields do not display within the Orbeon Instance Inspector.

Could someone show me the logic behind this mystery? Thanks in advance!!


---Philip


delete_working.xhtml

delete_broken.xhtml
Reply | Threaded
Open this post in threaded view
|

Re: trying to understand context when deleting nodes inside nested repeats

Erik Bruchez
Administrator
Philip,

Not 100% sure of what you want to do, but one thing is clearly wrong  
in your broken example. You have these:

   at="index('/metadata/idinfo/crossref/citeinfo-repeat')"

The index() function expects an integer. Here you are passing a string.

-Erik

On Jun 15, 2009, at 11:54 AM, Philip.Cantin wrote:

>
> Hi All,
>
> I have two sample XForms documents I have been using for testing  
> within
> Orbeon. With one of them, "delete_working.xhtml," you can add several
> fields, press the "Delete" button by that field, and it will delete  
> the
> correct field. With the other, "delete_broken.xhtml," if you add  
> several
> fields by clicking the "+" icon, then press the "x" icon beside one  
> of the
> fields, it will NOT delete that field, but rather the last one in  
> the list.
>
> I have been trying to find out for a while now what makes the other  
> one
> succeed and what makes the other one fail. I've tried adding things  
> to the
> broken one (such as xxforms:context() within certain attributes) as  
> well as
> removing things from the working one (such as <div>s and  
> <xf:group>s), but
> all to no avail. Also, I notice that in the broken one, updates to  
> fields do
> not display within the Orbeon Instance Inspector.
>
> Could someone show me the logic behind this mystery? Thanks in  
> advance!!
>
>
> ---Philip
>
>
> http://www.nabble.com/file/p24040744/delete_working.xhtml
> delete_working.xhtml
>
> http://www.nabble.com/file/p24040744/delete_broken.xhtml 
> delete_broken.xhtml
> --
> View this message in context: http://www.nabble.com/trying-to-understand-context-when-deleting-nodes-inside-nested-repeats-tp24040744p24040744.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
Reply | Threaded
Open this post in threaded view
|

Re: trying to understand context when deleting nodes inside nested repeats

Philip.Cantin
Erik,

Wait, you're saying the XPath function index() needs an integer parameter, not a string parameter? Maybe I'm missing something, but what about http://www.w3.org/TR/2002/CR-xforms-20021112/slice7.html#fn-index ? I'm using the 'at' attribute in the same manner within delete_broken.xhtml; both documents have 'at' attributes of <xf:delete> which pass values of repeat ids.

Basically, the gist of what I'm trying to do is to be able to get <xf:delete> to where it will delete the button corresponding to the field it is next to, not simply the last one in a list of repeated fields. You can do this with delete_working.xhtml:

1) Press the "Insert Citation Information" button three times.
2) Type in "abc" next to the "Origin" field within the first Citation Information section.
3) Press the "Delete Citation" button corresponding to the section whose Origin you just modified.
4) The correct field is deleted.


but not with delete_broken.xhtml:

1) Press the "+" button next to the "Cross Reference" field three times.
2) Type in "abc" next to the "Originator" field within the first Cross Reference section.
3) Press the "X" button corresponding to the section whose Originator was just modified.
4) The last created field is deleted, not the one with "abc" in it.



---Philip


Erik Bruchez wrote
Philip,

Not 100% sure of what you want to do, but one thing is clearly wrong  
in your broken example. You have these:

   at="index('/metadata/idinfo/crossref/citeinfo-repeat')"

The index() function expects an integer. Here you are passing a string.

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: trying to understand context when deleting nodes inside nested repeats

Philip.Cantin
Ah, I found the problem, which Alex even brought up in another thread.

There was an <input> tag that should have been <xf:input>. Amazing how three missing characters can siginificantly alter the functionality of a form...

Thanks for the help, Erik and Alex!


---Philip



Philip.Cantin wrote
Erik,

Wait, you're saying the XPath function index() needs an integer parameter, not a string parameter? Maybe I'm missing something, but what about http://www.w3.org/TR/2002/CR-xforms-20021112/slice7.html#fn-index ? I'm using the 'at' attribute in the same manner within delete_broken.xhtml; both documents have 'at' attributes of <xf:delete> which pass values of repeat ids.

Basically, the gist of what I'm trying to do is to be able to get <xf:delete> to where it will delete the button corresponding to the field it is next to, not simply the last one in a list of repeated fields. You can do this with delete_working.xhtml:

1) Press the "Insert Citation Information" button three times.
2) Type in "abc" next to the "Origin" field within the first Citation Information section.
3) Press the "Delete Citation" button corresponding to the section whose Origin you just modified.
4) The correct field is deleted.


but not with delete_broken.xhtml:

1) Press the "+" button next to the "Cross Reference" field three times.
2) Type in "abc" next to the "Originator" field within the first Cross Reference section.
3) Press the "X" button corresponding to the section whose Originator was just modified.
4) The last created field is deleted, not the one with "abc" in it.



---Philip


Erik Bruchez wrote
Philip,

Not 100% sure of what you want to do, but one thing is clearly wrong  
in your broken example. You have these:

   at="index('/metadata/idinfo/crossref/citeinfo-repeat')"

The index() function expects an integer. Here you are passing a string.

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: Re: trying to understand context when deleting nodes inside nested repeats

Erik Bruchez
Administrator
In reply to this post by Philip.Cantin
> Wait, you're saying the XPath function index() needs an integer  
> parameter,
> not a string parameter? Maybe I'm missing something, but what about
> http://www.w3.org/TR/2002/CR-xforms-20021112/slice7.html#fn-index ?  
> I'm
> using the 'at' attribute in the same manner within  
> delete_broken.xhtml; both
> documents have 'at' attributes of <xf:delete> which pass values of  
> repeat
> ids.

Sorry my bad, must have been late ;)

Anyway what I should have said was that you are passing an XPath  
expression as a literal between quotes, and it is doubtful that this  
is what you want to do, because the parameter of the index() function  
is the identifier of a repeat. With the following:

   index('/metadata/idinfo/crossref/citeinfo-repeat')

the identifier is literally:

   /metadata/idinfo/crossref/citeinfo-repeat

-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