Re: Re: Re: Altering dynamic itemset does not alter select control reference

Posted by Alessandro Vernet on
URL: https://discuss.orbeon.com/Altering-dynamic-itemset-does-not-alter-select-control-reference-tp1461843p1470656.html

Hi Hank,

This is because when you remove a <thing>, say the first one, after
selecting it, the value in <selected-thing> is still "one" (!= '').
Removing an item in an itemset does not changes the value of the node
to which the select(1) using that itemset is bound. So after you
remove the <thing>, you'll want to set selected-things to empty
string. See the updated example:

http://pastie.org/811425

Alex

On Fri, Feb 5, 2010 at 10:20 AM, Hank Ratzesberger
<[hidden email]> wrote:

> Hi Erik,
>
> Yes, apologies.... Attached is an example that I don't think has its
> own bugs.  You must reload it, however, with each test.
>
> The select lists the things that can be deleted, the trigger
> deletes every selected thing, but the element the trigger is
> bound to, is not recalculated.
>
> Best,
> Hank
>
>
>
>
>
>
>
>
> On Feb 4, 2010, at 5:23 PM, Erik Bruchez wrote:
>
>> Hank,
>>
>> That sounds weird. Yes, a sandbox-able example would be good!
>>
>> -Erik
>>
>> On Wed, Feb 3, 2010 at 2:15 PM, Hank Ratzesberger
>> <[hidden email]> wrote:
>>> Hi programmers and residents of Saturn (see @orbeon ;)
>>>
>>> The itemset for a select control is an instance that other
>>> controls in the form insert into.  A trigger allows the user
>>> to delete from the list -- click one or more in the select
>>> control and click the "Remove" button/trigger.
>>>
>>> All is working except that the reference to the select
>>> is not recalculated  -- it lists all the strings that
>>> were ever selected.
>>>
>>> I am not sure if there was another step or this is a bug.
>>>
>>> I can point you to a the form, or, complete what I started below
>>> for the sandbox. I didn't recognize anything in the Forge that
>>> looked like this issue.
>>>
>>> Cheers,
>>> Hank
>>>
>>> <xforms:instance id="things">
>>>        <things xmlns=""/>
>>> </xforms:instance>
>>>
>>> <xforms:instance id="select-form">
>>>    <config xmlns="">
>>>        <thing-names/>
>>>        <remove>true</remove> <!-- Initially disabled -->
>>>    </config>
>>> </xforms:instance>
>>>
>>> <xforms:bind nodeset="instance('select-form')">
>>>    <xforms:bind nodeset="remove" type="xs:boolean"
>>>        readonly="boolean-from-string(.)"
>>>        calculate="empty(instance('things')//thing)"/>
>>> </xforms:bind>
>>>
>>>
>>> <!-- In the form, the select lists "things" that were added elsewhere, and
>>>     below it, a trigger deletes the things.  The UI is in sync, but the
>>>      instance('thing-form')/remove retains values.
>>> -->
>>>
>>> <xforms:select ref="instance('select-form')/thing-names" appearance="compact">
>>>  <xforms:itemset nodeset="instance('things')//thing">
>>>     <xforms:value value="name"/>
>>>     <xforms:label><xforms:output value="name"/></xforms:label>
>>>   </xforms:itemset>
>>>  </xforms:select>
>>>
>>> <xforms:trigger ref="instance('select-form')/remove">
>>>    <xforms:label> Remove Selected Things </xforms:label>
>>>    <xforms:action ev:event="DOMActivate">
>>>        <xforms:delete nodeset="instance('things')/thing[name=tokenize(instance('select-form')/remove,'\s')]"/>
>>>    </xforms:action>
>>> </xforms:trigger>
>>>
>>>
>>>
>>> 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
>>>
>>>
>>
>> --
>> 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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet