XBL and xforms:repeat + fr:error-summary => bug ?

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

XBL and xforms:repeat + fr:error-summary => bug ?

Grégoire Neuville
Hello again,

I just came across an issue which I'm not sure whether it should be
considered a bug. I've got an XBL component which essentially does
what fr:repeat does. It thus has an xforms:repeat, it copies any
content in it and also has triggers to add or remove rows. It works
fine except in a situation where an xbl repeater is the parent of
another one which in turn is the parent of say an input, like this :

<my:repeat ref="toto" minOccur="0" maxOccur="1">
    <my:repeat ref="tutu" minOccur="1" maxOccur="1">
        <input ref="."> <!-- note that there exists an xforms:bind
constraint="normalize-space()" on this node -->

At form load, fr-form-instance has no 'toto' node ; when I press the
'add' button of the first repeater, the fr:error-summary hangs while
evaluating the expression that calculates the value of $full-id
variable (l. 199 of error-summary.xbl on 3.9-stable). This expression
is :

string-join((for $r in $repeat-ancestors return concat($r, '·',
$repeat-indexes[index-of($repeat-ancestors, $r)]), $prefixed-id), '/')

Adding a 'distinct-values' in it like this :

string-join((for $r in $repeat-ancestors return concat($r, '·',
$repeat-indexes[index-of(distinct-values($repeat-ancestors), $r)]),
$prefixed-id), '/')

fixes the pb.

This problem is thus that in the special situation I described,
$repeat-ancestors contains twice the same identifier : the one of the
xforms-repeat declared in the my:repeat component.

So, bug or not bug ? I could also work around the issue by generating
the id of the afore mentioned xforms-repeat using generate-id(), but
it scares me a bit. The XBL layer is the one intended to manage ids
and I wouldn't want to mess up the system.

Thanks,
--
Grégoire Neuville


--
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: XBL and xforms:repeat + fr:error-summary => bug ?

Erik Bruchez
Administrator
Grégoire,

If you specify an explicit id in "outer" scope within your XBL
template, then things will typically fail within repeats. So my
recommendation is to avoid specifying an explicit id, or to make the
repeat in the "inner" scope. (We know this concept of scopes is a bit
hard to grasp and we hope to improve on this in the future.)

-Erik

2011/9/27 Grégoire Neuville <[hidden email]>:

> Hello again,
>
> I just came across an issue which I'm not sure whether it should be
> considered a bug. I've got an XBL component which essentially does
> what fr:repeat does. It thus has an xforms:repeat, it copies any
> content in it and also has triggers to add or remove rows. It works
> fine except in a situation where an xbl repeater is the parent of
> another one which in turn is the parent of say an input, like this :
>
> <my:repeat ref="toto" minOccur="0" maxOccur="1">
>    <my:repeat ref="tutu" minOccur="1" maxOccur="1">
>        <input ref="."> <!-- note that there exists an xforms:bind
> constraint="normalize-space()" on this node -->
>
> At form load, fr-form-instance has no 'toto' node ; when I press the
> 'add' button of the first repeater, the fr:error-summary hangs while
> evaluating the expression that calculates the value of $full-id
> variable (l. 199 of error-summary.xbl on 3.9-stable). This expression
> is :
>
> string-join((for $r in $repeat-ancestors return concat($r, '·',
> $repeat-indexes[index-of($repeat-ancestors, $r)]), $prefixed-id), '/')
>
> Adding a 'distinct-values' in it like this :
>
> string-join((for $r in $repeat-ancestors return concat($r, '·',
> $repeat-indexes[index-of(distinct-values($repeat-ancestors), $r)]),
> $prefixed-id), '/')
>
> fixes the pb.
>
> This problem is thus that in the special situation I described,
> $repeat-ancestors contains twice the same identifier : the one of the
> xforms-repeat declared in the my:repeat component.
>
> So, bug or not bug ? I could also work around the issue by generating
> the id of the afore mentioned xforms-repeat using generate-id(), but
> it scares me a bit. The XBL layer is the one intended to manage ids
> and I wouldn't want to mess up the system.
>
> Thanks,
> --
> Grégoire Neuville
>
>
> --
> 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 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: Re: XBL and xforms:repeat + fr:error-summary => bug ?

Grégoire Neuville
Erik,

Thanks for the answer. Actually the problem isn't - at least directly
- related to my component which, as I said, works fine. It has the
following structure :

http://pastie.org/2610062

in which you can see that there is no id declared in outer scope,
since only the repeater bears an id and it is declared in inner scope.

Moreover, if the input I mentioned in my earlier post isn't associated
with any MIP, all the thing behaves ok. That's why I thought I had
found a bug : do you foresee any side effects of the fix
(distinct-values) I proposed ?

(note that there is no hurry to resolve this on my side because I
worked around it using id generation)

Thanks.

On 29 September 2011 06:09, Erik Bruchez <[hidden email]> wrote:

> Grégoire,
>
> If you specify an explicit id in "outer" scope within your XBL
> template, then things will typically fail within repeats. So my
> recommendation is to avoid specifying an explicit id, or to make the
> repeat in the "inner" scope. (We know this concept of scopes is a bit
> hard to grasp and we hope to improve on this in the future.)
>
> -Erik
>
> 2011/9/27 Grégoire Neuville <[hidden email]>:
>> Hello again,
>>
>> I just came across an issue which I'm not sure whether it should be
>> considered a bug. I've got an XBL component which essentially does
>> what fr:repeat does. It thus has an xforms:repeat, it copies any
>> content in it and also has triggers to add or remove rows. It works
>> fine except in a situation where an xbl repeater is the parent of
>> another one which in turn is the parent of say an input, like this :
>>
>> <my:repeat ref="toto" minOccur="0" maxOccur="1">
>>    <my:repeat ref="tutu" minOccur="1" maxOccur="1">
>>        <input ref="."> <!-- note that there exists an xforms:bind
>> constraint="normalize-space()" on this node -->
>>
>> At form load, fr-form-instance has no 'toto' node ; when I press the
>> 'add' button of the first repeater, the fr:error-summary hangs while
>> evaluating the expression that calculates the value of $full-id
>> variable (l. 199 of error-summary.xbl on 3.9-stable). This expression
>> is :
>>
>> string-join((for $r in $repeat-ancestors return concat($r, '·',
>> $repeat-indexes[index-of($repeat-ancestors, $r)]), $prefixed-id), '/')
>>
>> Adding a 'distinct-values' in it like this :
>>
>> string-join((for $r in $repeat-ancestors return concat($r, '·',
>> $repeat-indexes[index-of(distinct-values($repeat-ancestors), $r)]),
>> $prefixed-id), '/')
>>
>> fixes the pb.
>>
>> This problem is thus that in the special situation I described,
>> $repeat-ancestors contains twice the same identifier : the one of the
>> xforms-repeat declared in the my:repeat component.
>>
>> So, bug or not bug ? I could also work around the issue by generating
>> the id of the afore mentioned xforms-repeat using generate-id(), but
>> it scares me a bit. The XBL layer is the one intended to manage ids
>> and I wouldn't want to mess up the system.
>>
>> Thanks,
>> --
>> Grégoire Neuville
>>
>>
>> --
>> 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 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
>
>


--
Grégoire Neuville


--
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