Re: Re: fr-set-label for fr:autocomplete in an XBL component

Posted by Alessandro Vernet on
URL: https://discuss.orbeon.com/fr-set-label-for-fr-autocomplete-in-an-XBL-component-tp2916972p2966086.html

Hi Ethan,

First, xforms-ready is intentionally not supported on models of XBL
components. As you found out, you should use
xforms-model-construct-done in that case (an in general, in most cases
it makes more sense to use xforms-model-construct-done). This is
documented on:

http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components-guide#TOC-Construction-and-destruction-of-loc

Second, you are doing a <xforms:dispatch target="$binding">. The value
of the "target" attribute is expected to be an id (not an XPath
expression returning a node to which a control is bound). So in your
case, if you want to dispatch this to the <fr:autocomplete>, you can
try: <xforms:dispatch target="subject-autocomplete-control">.

You'll let us know how this works for you,

Alex

On Fri, Oct 1, 2010 at 1:06 PM, Ethan Gruber <[hidden email]> wrote:

> As a followup, I noticed that xforms-ready isn't supported in local XBL
> models, so I switched to using xforms-model-construct-done.  I can write a
> test value to a test instance, but I'm not sure how to access the value of
> the fr:autocomplete bound by $binding from within the local model.
>
> I wanted to try testing setting the label with a test value in the mean
> time.  The following is in the local model for my XBL component:
>
> <xforms:action ev:event="xforms-model-construct-done">
>   <xforms:dispatch target="subject-autocomplete-control"
> name="fr-set-label">
>     <xxforms:context name="label" select="'test'"/>
>   </xforms:dispatch>
> </xforms:action>
>
> It has no effect on setting the label.  I'm kind of lost.  I'm sure it is
> theoretically possible to set the label for each fr:autocomplete on
> xforms-model-contruct-done, but I'm not entirely sure of the syntax.
>
> Thanks for the help,
> Ethan
>
> On Fri, Oct 1, 2010 at 10:49 AM, Ethan Gruber <[hidden email]> wrote:
>>
>> I'm finally getting around to doing the smart thing and moving my
>> autocomplete controls into XBL components to better facilitate repeatability
>> within my form.  The transition is nearly complete (the dynamic itemset is
>> populated based on queries that the user types into the fr:autocomplete text
>> input), but I haven't quite figured out how to set the label of the XBL
>> component when the document reloads in the form.
>>
>> Before the change to XBL, the code to set the labels looked something like
>> this:
>>
>> <xforms:action ev:event="xforms-ready">
>>   <xforms:action xxforms:iterate="//subject">
>>     <xxforms:variable name="name" select="name()"/>
>>     <xforms:setindex repeat="{concat($name, '-repeat')}"
>> index="position()"/>
>>     <xforms:dispatch target="{concat($name, '-autocomplete-control')}"
>> name="fr-set-label">
>>       <xxforms:context name="label" select="normalize-space(context())"/>
>>     </xforms:dispatch>
>>   </xforms:action>
>> </xforms:action>
>>
>> This action is defined in the model for my form.  It doesn't successfully
>> set the label of the fr:autocomplete contained in XBL.
>>
>> In my test form, I am calling the new component with this:
>>
>> <xforms:repeat nodeset="subject" id="subject-repeat">
>>   <eaditor:subject-autocomplete ref="."/>
>> </xforms:repeat>
>>
>> Attached is the XBL component.  It contains a model, but it seems that
>> <xforms:action ev:event="xforms-ready"> does not work in that model.  Since
>> the above xforms:action does not set the label of the component when
>> embedded into the model in my test form, I'm not quite sure where the
>> problem lies or potential workarounds.
>>
>> Help would be greatly appreciated,
>> Ethan
>
>
>
> --
> 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 -
http://www.orbeon.com/
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