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

Posted by Ethan Gruber on
URL: https://discuss.orbeon.com/fr-set-label-for-fr-autocomplete-in-an-XBL-component-tp2916972p3037117.html

Alex,

This may be of some help, but a simple test with an <fr:autocomplete> embedded directly in the form rather than as a called XBL component has revealed that the label does not get set with xforms-model-construct-done, but only xforms-ready.

Ethan

On Thu, Oct 28, 2010 at 3:12 PM, Ethan Gruber <[hidden email]> wrote:
Hi Alex,

I believe I have done this in the way that you have described, so I have included a form.  I can add repeatable subjects and the Solr querying works fine for autocomplete.  It's just that set-label doesn't work on xforms-model-construct-done in my code.

The form queries a server at localhost, but this isn't important as I have already populated a test model with a value to load.

Thanks for your help,
Ethan


On Sat, Oct 23, 2010 at 1:48 PM, Alessandro Vernet <[hidden email]> wrote:
Ethan,

Yes, xforms-model-construct-done is called in your XBL local model.
And yes, you can dispatch an event to a control inside your XBL
component, referring to that control by id. You need to make sure that
the control in a section of your XBL which is in inner scope
(xxbl:scope="inner"), as your XBL model is always in inner scope.

If this doesn't work, I would setup debugging for development (see
link below, if you don't already have this setup), and look at exactly
what is happening the sequence of events in the log. If your dispatch
has no effect because Orbeon Forms can't find the specified id, the
log will tell you about it.

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-logging#TOC-Development-configuration

And of course, if you have a simple and reproducible case, we can also
look at it, if this can help.

Alex

On Fri, Oct 15, 2010 at 11:25 AM, Ethan Gruber <[hidden email]> wrote:
> Am I correct in assuming that the xforms-model-construct-done action should
> be called in the local xforms:model within the XBL component?
>
> I tried the following:
>
> <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>
>
> But it isn't setting the label to 'test'.  Is something missing?
>
> Thanks,
> Ethan
>
>
>
> On Wed, Oct 6, 2010 at 9:56 PM, Alessandro Vernet <[hidden email]>
> wrote:
>>
>> 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
>>
>
>
>
> --
> 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





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