I am nearly finished my work on autosuggest of Library of Congress terms from a Solr index, but there is one final barrier to tackle. When I load my XML file into my form, the text input of the fr:autocomplete is blank. I am successfully repopulating my itemset with the element value on xforms-ready so that the <li> within fr-autocomplete-yui-div contains the subject term, but this subject term does not appear within the text input itself.
I think this may be the answer: http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components#TOC-Setting-the-content-of-the-text-fie But I'm not quite clear on the use of xforms:dispatch. Is the @target the id of the fr:autocomplete? What happens when I have two or more fr:autocompletes in my document since the <subject> element is repeatable? Here is a stripped down version of my fr:autocomplete code (it really just has the itemset--the rest of the code is nearly identical to the example in the link above): <xforms:repeat nodeset="subject"> <div style="margin-top:10px;display:table;width:100%"> <xxforms:variable name="uid" select="position()"/> <fr:autocomplete ref="." dynamic-itemset="true"> snip <xforms:label style="float:left">Subject</xforms:label> <!-- get response from current position in suggestions-aggregate instance --> <xforms:itemset nodeset="instance('suggestions-aggregate')/response[$uid]//lst[@name='subject']/int"> <xforms:label ref="@name"/> <xforms:value ref="@name"/> </xforms:itemset> </fr:autocomplete> <xforms:trigger appearance="minimal" style="float:left"> <xforms:delete ev:event="DOMActivate" nodeset="instance('suggestions-aggregate')/response[$uid]"/> <xforms:delete ev:event="DOMActivate" nodeset="."/> <xforms:label> <img src="/apps/ead/images/remove.gif"/> </xforms:label> </xforms:trigger> </div> </xforms:repeat> On xforms-ready I iterate through each subject element and populate its itemset with this code I have placed in the model: <xforms:action ev:event="xforms-ready" xxforms:iterate="instance('guide')/archdesc/controlaccess/subject"> <xforms:insert context="instance('suggestions-aggregate')" nodeset="response" origin="instance('response-temp')"/> <xforms:setvalue ref="instance('suggestions-aggregate')/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" value="context()"/> <!--<xforms:dispatch> </xforms:dispatch>--> </xforms:action> Should I execute the xforms:dispatch while the iteration occurs? Thanks, 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 |
Administrator
|
Ethan,
It is more complicated than this. I think you hit again a consequence of this limitation: http://forge.ow2.org/tracker/index.php?func=detail&aid=314755&group_id=168&atid=350207 I spent quite a bit of time on this one since last week (yep, that limitation really bothered me too), and now you can set the value of an autocomplete control when using the static itemset mode. Note that this won't work in dynamic itemset mode (use the fr-search-changed event in that case) for the reasons exposed here: http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/autocomplete#TOC-Setting-by-value This change will be in the next nightly build. Alex On Fri, May 14, 2010 at 7:23 AM, Ethan Gruber <[hidden email]> wrote: > I am nearly finished my work on autosuggest of Library of Congress terms > from a Solr index, but there is one final barrier to tackle. When I load my > XML file into my form, the text input of the fr:autocomplete is blank. I am > successfully repopulating my itemset with the element value on xforms-ready > so that the <li> within fr-autocomplete-yui-div contains the subject term, > but this subject term does not appear within the text input itself. > > I think this may be the answer: > http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components#TOC-Setting-the-content-of-the-text-fie > > But I'm not quite clear on the use of xforms:dispatch. Is the @target the > id of the fr:autocomplete? What happens when I have two or more > fr:autocompletes in my document since the <subject> element is repeatable? > > > Here is a stripped down version of my fr:autocomplete code (it really just > has the itemset--the rest of the code is nearly identical to the example in > the link above): > > <xforms:repeat nodeset="subject"> > <div style="margin-top:10px;display:table;width:100%"> > <xxforms:variable name="uid" select="position()"/> > <fr:autocomplete ref="." dynamic-itemset="true"> > > snip > > <xforms:label style="float:left">Subject</xforms:label> > <!-- get response from current position in > suggestions-aggregate instance --> > <xforms:itemset > > nodeset="instance('suggestions-aggregate')/response[$uid]//lst[@name='subject']/int"> > <xforms:label ref="@name"/> > <xforms:value ref="@name"/> > </xforms:itemset> > </fr:autocomplete> > <xforms:trigger appearance="minimal" style="float:left"> > <xforms:delete ev:event="DOMActivate" > > nodeset="instance('suggestions-aggregate')/response[$uid]"/> > <xforms:delete ev:event="DOMActivate" nodeset="."/> > <xforms:label> > <img src="/apps/ead/images/remove.gif"/> > </xforms:label> > </xforms:trigger> > </div> > </xforms:repeat> > > On xforms-ready I iterate through each subject element and populate its > itemset with this code I have placed in the model: > > <xforms:action ev:event="xforms-ready" > > xxforms:iterate="instance('guide')/archdesc/controlaccess/subject"> > <xforms:insert context="instance('suggestions-aggregate')" > nodeset="response" > origin="instance('response-temp')"/> > <xforms:setvalue > ref="instance('suggestions-aggregate')/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" > value="context()"/> > <!--<xforms:dispatch> > > </xforms:dispatch>--> > </xforms:action> > > Should I execute the xforms:dispatch while the iteration occurs? > > Thanks, > 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 |
Hello, Alex --
I continue to follow in Ethan's footsteps, and now I'm now also working on initializing a dynamic itemset autocomplete field within a repeat. I chatted a bit with Ethan offline, and we haven't yet been able to get it to work. We're a bit confused by this paragraph in the wiki: http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/autocomplete#TOC-Setting-the-content-of-the-text-fie "Setting by value [...] Don't set the value of the node bound to an autocomplete control if you are using a dynamic itemset. This is because in dynamic itemset mode, you load the itemset based on the search term entered by users, responding to the fr-search-changed event. If the value is set, the autocomplete can't dispatch a fr-search-changed event, since it doesn't know the label yet, and your code won't load the appropriate itemset that contains the label for the new value. In dynamic itemset mode, always use the fr-set-label event to indirectly set the value of the control. If you want the autocomplete to be populated based on a value in the instance when the form loads, on xforms-model-construct-done you need to find what the label corresponding to this value is, and dispatch an fr-set-label event with that label." Do you have a sample XForms snippet that demonstrates how to prepopulate a dynamic itemset autocomplete within a repeat? In particular, showing a sample instance with a value, a control, and a label that is set to the value by dispatching an event? thanks, -- Scott Alessandro Vernet wrote: > Ethan, > > It is more complicated than this. I think you hit again a consequence > of this limitation: > > http://forge.ow2.org/tracker/index.php?func=detail&aid=314755&group_id=168&atid=350207 > > I spent quite a bit of time on this one since last week (yep, that > limitation really bothered me too), and now you can set the value of > an autocomplete control when using the static itemset mode. Note that > this won't work in dynamic itemset mode (use the fr-search-changed > event in that case) for the reasons exposed here: > > http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/autocomplete#TOC-Setting-by-value > > This change will be in the next nightly build. > > Alex > > On Fri, May 14, 2010 at 7:23 AM, Ethan Gruber <[hidden email]> wrote: >> I am nearly finished my work on autosuggest of Library of Congress terms >> from a Solr index, but there is one final barrier to tackle. When I load my >> XML file into my form, the text input of the fr:autocomplete is blank. I am >> successfully repopulating my itemset with the element value on xforms-ready >> so that the <li> within fr-autocomplete-yui-div contains the subject term, >> but this subject term does not appear within the text input itself. >> >> I think this may be the answer: >> http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components#TOC-Setting-the-content-of-the-text-fie >> >> But I'm not quite clear on the use of xforms:dispatch. Is the @target the >> id of the fr:autocomplete? What happens when I have two or more >> fr:autocompletes in my document since the <subject> element is repeatable? >> >> >> Here is a stripped down version of my fr:autocomplete code (it really just >> has the itemset--the rest of the code is nearly identical to the example in >> the link above): >> >> <xforms:repeat nodeset="subject"> >> <div style="margin-top:10px;display:table;width:100%"> >> <xxforms:variable name="uid" select="position()"/> >> <fr:autocomplete ref="." dynamic-itemset="true"> >> >> snip >> >> <xforms:label style="float:left">Subject</xforms:label> >> <!-- get response from current position in >> suggestions-aggregate instance --> >> <xforms:itemset >> >> nodeset="instance('suggestions-aggregate')/response[$uid]//lst[@name='subject']/int"> >> <xforms:label ref="@name"/> >> <xforms:value ref="@name"/> >> </xforms:itemset> >> </fr:autocomplete> >> <xforms:trigger appearance="minimal" style="float:left"> >> <xforms:delete ev:event="DOMActivate" >> >> nodeset="instance('suggestions-aggregate')/response[$uid]"/> >> <xforms:delete ev:event="DOMActivate" nodeset="."/> >> <xforms:label> >> <img src="/apps/ead/images/remove.gif"/> >> </xforms:label> >> </xforms:trigger> >> </div> >> </xforms:repeat> >> >> On xforms-ready I iterate through each subject element and populate its >> itemset with this code I have placed in the model: >> >> <xforms:action ev:event="xforms-ready" >> >> xxforms:iterate="instance('guide')/archdesc/controlaccess/subject"> >> <xforms:insert context="instance('suggestions-aggregate')" >> nodeset="response" >> origin="instance('response-temp')"/> >> <xforms:setvalue >> ref="instance('suggestions-aggregate')/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" >> value="context()"/> >> <!--<xforms:dispatch> >> >> </xforms:dispatch>--> >> </xforms:action> >> >> Should I execute the xforms:dispatch while the iteration occurs? >> >> Thanks, >> 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 >> >> > > > -- Scott Prater Library, Instructional, and Research Applications (LIRA) Division of Information Technology (DoIT) University of Wisconsin - Madison [hidden email] -- 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 |
In reply to this post by Alessandro Vernet
Okay, I answered my own question. I was able to prepopulate
autocomplete dynamic itemsets within the repeat like this (using Ethan's example): <xforms:action ev:event="xforms-ready" xxforms:iterate="instance('guide')/archdesc/controlaccess/subject"> <xforms:insert context="instance('suggestions-aggregate')" nodeset="response" origin="instance('response-temp')"/> <xforms:setvalue ref="instance('suggestions-aggregate')/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" value="normalize-space(context())"/> <xforms:setindex repeat="subject-repeat" index="position()"/> <xforms:dispatch target="subject-autocomplete-control" name="fr-set-label"> <xxforms:context name="label" select="instance('suggestions-aggregate')/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name"/> </xforms:dispatch> </xforms:action> [...] <xforms:repeat nodeset="subject" id="subject-repeat"> [...] <fr:autocomplete ref="." dynamic-itemset="true" id="subject-autocomplete-control"> [...] </fr:autocomplete> </xforms:repeat> Some things to note, all of which I gathered from documentation: 1) the <xforms:dispatch> "target" attribute points to the fr:autocomplete form control ID; 2) the <xxforms:context> "select" attribute contains the XPath expression that points to the value you want the autocomplete text field to contain; 3) and the key to make it work in a repeat block: <xforms:setindex repeat="subject-repeat" index="position()"/> ... which puts the cursor in the repeat block at the same index as the cursor in the xxforms:iteration. If there's a better way to do this, or if there's something crucial I missed, please let me know. I cribbed this solution from a tip Erik posted about a year ago: http://orbeon-forms-ops-users.24843.n4.nabble.com/sending-events-to-repeated-controls-within-an-XBL-component-td45079.html thanks, -- Scott Scott Prater wrote: > Hello, Alex -- > > I continue to follow in Ethan's footsteps, and now I'm now also working > on initializing a dynamic itemset autocomplete field within a repeat. I > chatted a bit with Ethan offline, and we haven't yet been able to get it > to work. We're a bit confused by this paragraph in the wiki: > > http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/autocomplete#TOC-Setting-the-content-of-the-text-fie > > > "Setting by value > > [...] > > Don't set the value of the node bound to an autocomplete control if you > are using a dynamic itemset. This is because in dynamic itemset mode, > you load the itemset based on the search term entered by users, > responding to the fr-search-changed event. If the value is set, the > autocomplete can't dispatch a fr-search-changed event, since it doesn't > know the label yet, and your code won't load the appropriate itemset > that contains the label for the new value. In dynamic itemset mode, > always use the fr-set-label event to indirectly set the value of the > control. If you want the autocomplete to be populated based on a value > in the instance when the form loads, on xforms-model-construct-done you > need to find what the label corresponding to this value is, and dispatch > an fr-set-label event with that label." > > Do you have a sample XForms snippet that demonstrates how to prepopulate > a dynamic itemset autocomplete within a repeat? In particular, showing > a sample instance with a value, a control, and a label that is set to > the value by dispatching an event? > > thanks, > > -- Scott > > Alessandro Vernet wrote: -- Scott Prater Library, Instructional, and Research Applications (LIRA) Division of Information Technology (DoIT) University of Wisconsin - Madison [hidden email] -- 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 |
Administrator
|
Scott,
Great, thanks for sharing! -Erik On Tue, Jun 1, 2010 at 3:08 PM, Scott Prater <[hidden email]> wrote: > Okay, I answered my own question. I was able to prepopulate autocomplete > dynamic itemsets within the repeat like this (using Ethan's example): > > <xforms:action ev:event="xforms-ready" > xxforms:iterate="instance('guide')/archdesc/controlaccess/subject"> > <xforms:insert context="instance('suggestions-aggregate')" > nodeset="response" > origin="instance('response-temp')"/> > <xforms:setvalue > ref="instance('suggestions-aggregate')/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" > value="normalize-space(context())"/> > <xforms:setindex repeat="subject-repeat" index="position()"/> > <xforms:dispatch target="subject-autocomplete-control" > name="fr-set-label"> > <xxforms:context name="label" > select="instance('suggestions-aggregate')/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name"/> > </xforms:dispatch> > </xforms:action> > > [...] > > <xforms:repeat nodeset="subject" id="subject-repeat"> > [...] > <fr:autocomplete ref="." dynamic-itemset="true" > id="subject-autocomplete-control"> > [...] > </fr:autocomplete> > </xforms:repeat> > > Some things to note, all of which I gathered from documentation: > > 1) the <xforms:dispatch> "target" attribute points to the fr:autocomplete > form control ID; > > 2) the <xxforms:context> "select" attribute contains the XPath expression > that points to the value you want the autocomplete text field to contain; > > 3) and the key to make it work in a repeat block: > > <xforms:setindex repeat="subject-repeat" index="position()"/> > > ... which puts the cursor in the repeat block at the same index as the > cursor in the xxforms:iteration. > > If there's a better way to do this, or if there's something crucial I > missed, please let me know. > > I cribbed this solution from a tip Erik posted about a year ago: > http://orbeon-forms-ops-users.24843.n4.nabble.com/sending-events-to-repeated-controls-within-an-XBL-component-td45079.html > > thanks, > > -- Scott > > Scott Prater wrote: >> >> Hello, Alex -- >> >> I continue to follow in Ethan's footsteps, and now I'm now also working on >> initializing a dynamic itemset autocomplete field within a repeat. I >> chatted a bit with Ethan offline, and we haven't yet been able to get it to >> work. We're a bit confused by this paragraph in the wiki: >> >> >> http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/autocomplete#TOC-Setting-the-content-of-the-text-fie >> >> "Setting by value >> >> [...] >> >> Don't set the value of the node bound to an autocomplete control if you >> are using a dynamic itemset. This is because in dynamic itemset mode, you >> load the itemset based on the search term entered by users, responding to >> the fr-search-changed event. If the value is set, the autocomplete can't >> dispatch a fr-search-changed event, since it doesn't know the label yet, and >> your code won't load the appropriate itemset that contains the label for the >> new value. In dynamic itemset mode, always use the fr-set-label event to >> indirectly set the value of the control. If you want the autocomplete to be >> populated based on a value in the instance when the form loads, on >> xforms-model-construct-done you need to find what the label corresponding to >> this value is, and dispatch an fr-set-label event with that label." >> >> Do you have a sample XForms snippet that demonstrates how to prepopulate a >> dynamic itemset autocomplete within a repeat? In particular, showing a >> sample instance with a value, a control, and a label that is set to the >> value by dispatching an event? >> >> thanks, >> >> -- Scott >> >> Alessandro Vernet wrote: > > > -- > Scott Prater > Library, Instructional, and Research Applications (LIRA) > Division of Information Technology (DoIT) > University of Wisconsin - Madison > [hidden email] > > > -- > 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 |
Administrator
|
In reply to this post by Scott Prater
Scott,
I understand this can be a bit confusing. In essence, if you are using a dynamic itemset, i.e. loading data as users type in the field, then you can only set the value by setting the label, which is what the user would have typed. And you do this by dispatching the fr-set-label event to the autocomplete. Does this make more sense? Alex On Tue, Jun 1, 2010 at 1:23 PM, Scott Prater <[hidden email]> wrote: > Hello, Alex -- > > I continue to follow in Ethan's footsteps, and now I'm now also working on > initializing a dynamic itemset autocomplete field within a repeat. I > chatted a bit with Ethan offline, and we haven't yet been able to get it to > work. We're a bit confused by this paragraph in the wiki: > > http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/autocomplete#TOC-Setting-the-content-of-the-text-fie > > "Setting by value > > [...] > > Don't set the value of the node bound to an autocomplete control if you are > using a dynamic itemset. This is because in dynamic itemset mode, you load > the itemset based on the search term entered by users, responding to the > fr-search-changed event. If the value is set, the autocomplete can't > dispatch a fr-search-changed event, since it doesn't know the label yet, and > your code won't load the appropriate itemset that contains the label for the > new value. In dynamic itemset mode, always use the fr-set-label event to > indirectly set the value of the control. If you want the autocomplete to be > populated based on a value in the instance when the form loads, on > xforms-model-construct-done you need to find what the label corresponding to > this value is, and dispatch an fr-set-label event with that label." > > Do you have a sample XForms snippet that demonstrates how to prepopulate a > dynamic itemset autocomplete within a repeat? In particular, showing a > sample instance with a value, a control, and a label that is set to the > value by dispatching an event? > > thanks, > > -- Scott > > Alessandro Vernet wrote: >> >> Ethan, >> >> It is more complicated than this. I think you hit again a consequence >> of this limitation: >> >> >> http://forge.ow2.org/tracker/index.php?func=detail&aid=314755&group_id=168&atid=350207 >> >> I spent quite a bit of time on this one since last week (yep, that >> limitation really bothered me too), and now you can set the value of >> an autocomplete control when using the static itemset mode. Note that >> this won't work in dynamic itemset mode (use the fr-search-changed >> event in that case) for the reasons exposed here: >> >> >> http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/autocomplete#TOC-Setting-by-value >> >> This change will be in the next nightly build. >> >> Alex >> >> On Fri, May 14, 2010 at 7:23 AM, Ethan Gruber <[hidden email]> wrote: >>> >>> I am nearly finished my work on autosuggest of Library of Congress terms >>> from a Solr index, but there is one final barrier to tackle. When I load >>> my >>> XML file into my form, the text input of the fr:autocomplete is blank. I >>> am >>> successfully repopulating my itemset with the element value on >>> xforms-ready >>> so that the <li> within fr-autocomplete-yui-div contains the subject >>> term, >>> but this subject term does not appear within the text input itself. >>> >>> I think this may be the answer: >>> >>> http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components#TOC-Setting-the-content-of-the-text-fie >>> >>> But I'm not quite clear on the use of xforms:dispatch. Is the @target >>> the >>> id of the fr:autocomplete? What happens when I have two or more >>> fr:autocompletes in my document since the <subject> element is >>> repeatable? >>> >>> >>> Here is a stripped down version of my fr:autocomplete code (it really >>> just >>> has the itemset--the rest of the code is nearly identical to the example >>> in >>> the link above): >>> >>> <xforms:repeat nodeset="subject"> >>> <div style="margin-top:10px;display:table;width:100%"> >>> <xxforms:variable name="uid" select="position()"/> >>> <fr:autocomplete ref="." dynamic-itemset="true"> >>> >>> snip >>> >>> <xforms:label style="float:left">Subject</xforms:label> >>> <!-- get response from current position in >>> suggestions-aggregate instance --> >>> <xforms:itemset >>> >>> >>> nodeset="instance('suggestions-aggregate')/response[$uid]//lst[@name='subject']/int"> >>> <xforms:label ref="@name"/> >>> <xforms:value ref="@name"/> >>> </xforms:itemset> >>> </fr:autocomplete> >>> <xforms:trigger appearance="minimal" style="float:left"> >>> <xforms:delete ev:event="DOMActivate" >>> >>> nodeset="instance('suggestions-aggregate')/response[$uid]"/> >>> <xforms:delete ev:event="DOMActivate" nodeset="."/> >>> <xforms:label> >>> <img src="/apps/ead/images/remove.gif"/> >>> </xforms:label> >>> </xforms:trigger> >>> </div> >>> </xforms:repeat> >>> >>> On xforms-ready I iterate through each subject element and populate its >>> itemset with this code I have placed in the model: >>> >>> <xforms:action ev:event="xforms-ready" >>> >>> xxforms:iterate="instance('guide')/archdesc/controlaccess/subject"> >>> <xforms:insert context="instance('suggestions-aggregate')" >>> nodeset="response" >>> origin="instance('response-temp')"/> >>> <xforms:setvalue >>> >>> ref="instance('suggestions-aggregate')/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" >>> value="context()"/> >>> <!--<xforms:dispatch> >>> >>> </xforms:dispatch>--> >>> </xforms:action> >>> >>> Should I execute the xforms:dispatch while the iteration occurs? >>> >>> Thanks, >>> 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 >>> >>> >> >> >> > > > -- > Scott Prater > Library, Instructional, and Research Applications (LIRA) > Division of Information Technology (DoIT) > University of Wisconsin - Madison > [hidden email] > > > -- > 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 |
Hi Alex,
Scott and I (mostly Scott) got it figured out. There is one other issue I have run into with this version of fr:autocomplete versus the version from 3.7.1. If I enter a completely new value into fr:autocomplete that does not match anything returned in a dynamic itemset, the value of the field is not set. This can be a problem when you want to enter new terms that are not part of the current controlled vocabulary. Thanks, Ethan On Thu, Jun 24, 2010 at 8:02 PM, Alessandro Vernet <[hidden email]> wrote: Scott, -- 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 |
Administrator
|
Hi Ethan,
That's right: the "new" autocomplete won't populate the bound node if what users type is not in the itemset. This is tied to the idea that what you type is the item's label, and what goes into the node is the item's value. It looks like you'd like to have the following logic: if there is no item with that label, just do as if there was one, which value is equal to the label. This is something that you can implement: handle the fr-search-changed event, and check if there is an item for what the user typed. If there isn't: create one setting the label and the value to what the user typed. You can then replace the label/value in that item when the user types something different, instead of repeatedly adding new items. Would this make sense? Alex On Fri, Jun 25, 2010 at 6:19 AM, Ethan Gruber <[hidden email]> wrote: > Hi Alex, > > Scott and I (mostly Scott) got it figured out. There is one other issue I > have run into with this version of fr:autocomplete versus the version from > 3.7.1. If I enter a completely new value into fr:autocomplete that does not > match anything returned in a dynamic itemset, the value of the field is not > set. This can be a problem when you want to enter new terms that are not > part of the current controlled vocabulary. > > Thanks, > Ethan > > On Thu, Jun 24, 2010 at 8:02 PM, Alessandro Vernet <[hidden email]> > wrote: >> >> Scott, >> >> I understand this can be a bit confusing. In essence, if you are using >> a dynamic itemset, i.e. loading data as users type in the field, then >> you can only set the value by setting the label, which is what the >> user would have typed. And you do this by dispatching the fr-set-label >> event to the autocomplete. Does this make more sense? >> >> Alex >> >> On Tue, Jun 1, 2010 at 1:23 PM, Scott Prater <[hidden email]> wrote: >> > Hello, Alex -- >> > >> > I continue to follow in Ethan's footsteps, and now I'm now also working >> > on >> > initializing a dynamic itemset autocomplete field within a repeat. I >> > chatted a bit with Ethan offline, and we haven't yet been able to get it >> > to >> > work. We're a bit confused by this paragraph in the wiki: >> > >> > >> > http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/autocomplete#TOC-Setting-the-content-of-the-text-fie >> > >> > "Setting by value >> > >> > [...] >> > >> > Don't set the value of the node bound to an autocomplete control if you >> > are >> > using a dynamic itemset. This is because in dynamic itemset mode, you >> > load >> > the itemset based on the search term entered by users, responding to the >> > fr-search-changed event. If the value is set, the autocomplete can't >> > dispatch a fr-search-changed event, since it doesn't know the label yet, >> > and >> > your code won't load the appropriate itemset that contains the label for >> > the >> > new value. In dynamic itemset mode, always use the fr-set-label event to >> > indirectly set the value of the control. If you want the autocomplete to >> > be >> > populated based on a value in the instance when the form loads, on >> > xforms-model-construct-done you need to find what the label >> > corresponding to >> > this value is, and dispatch an fr-set-label event with that label." >> > >> > Do you have a sample XForms snippet that demonstrates how to prepopulate >> > a >> > dynamic itemset autocomplete within a repeat? In particular, showing a >> > sample instance with a value, a control, and a label that is set to the >> > value by dispatching an event? >> > >> > thanks, >> > >> > -- Scott >> > >> > Alessandro Vernet wrote: >> >> >> >> Ethan, >> >> >> >> It is more complicated than this. I think you hit again a consequence >> >> of this limitation: >> >> >> >> >> >> >> >> http://forge.ow2.org/tracker/index.php?func=detail&aid=314755&group_id=168&atid=350207 >> >> >> >> I spent quite a bit of time on this one since last week (yep, that >> >> limitation really bothered me too), and now you can set the value of >> >> an autocomplete control when using the static itemset mode. Note that >> >> this won't work in dynamic itemset mode (use the fr-search-changed >> >> event in that case) for the reasons exposed here: >> >> >> >> >> >> >> >> http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/autocomplete#TOC-Setting-by-value >> >> >> >> This change will be in the next nightly build. >> >> >> >> Alex >> >> >> >> On Fri, May 14, 2010 at 7:23 AM, Ethan Gruber <[hidden email]> >> >> wrote: >> >>> >> >>> I am nearly finished my work on autosuggest of Library of Congress >> >>> terms >> >>> from a Solr index, but there is one final barrier to tackle. When I >> >>> load >> >>> my >> >>> XML file into my form, the text input of the fr:autocomplete is blank. >> >>> I >> >>> am >> >>> successfully repopulating my itemset with the element value on >> >>> xforms-ready >> >>> so that the <li> within fr-autocomplete-yui-div contains the subject >> >>> term, >> >>> but this subject term does not appear within the text input itself. >> >>> >> >>> I think this may be the answer: >> >>> >> >>> >> >>> http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components#TOC-Setting-the-content-of-the-text-fie >> >>> >> >>> But I'm not quite clear on the use of xforms:dispatch. Is the @target >> >>> the >> >>> id of the fr:autocomplete? What happens when I have two or more >> >>> fr:autocompletes in my document since the <subject> element is >> >>> repeatable? >> >>> >> >>> >> >>> Here is a stripped down version of my fr:autocomplete code (it really >> >>> just >> >>> has the itemset--the rest of the code is nearly identical to the >> >>> example >> >>> in >> >>> the link above): >> >>> >> >>> <xforms:repeat nodeset="subject"> >> >>> <div style="margin-top:10px;display:table;width:100%"> >> >>> <xxforms:variable name="uid" select="position()"/> >> >>> <fr:autocomplete ref="." dynamic-itemset="true"> >> >>> >> >>> snip >> >>> >> >>> <xforms:label style="float:left">Subject</xforms:label> >> >>> <!-- get response from current position in >> >>> suggestions-aggregate instance --> >> >>> <xforms:itemset >> >>> >> >>> >> >>> >> >>> nodeset="instance('suggestions-aggregate')/response[$uid]//lst[@name='subject']/int"> >> >>> <xforms:label ref="@name"/> >> >>> <xforms:value ref="@name"/> >> >>> </xforms:itemset> >> >>> </fr:autocomplete> >> >>> <xforms:trigger appearance="minimal" style="float:left"> >> >>> <xforms:delete ev:event="DOMActivate" >> >>> >> >>> nodeset="instance('suggestions-aggregate')/response[$uid]"/> >> >>> <xforms:delete ev:event="DOMActivate" nodeset="."/> >> >>> <xforms:label> >> >>> <img src="/apps/ead/images/remove.gif"/> >> >>> </xforms:label> >> >>> </xforms:trigger> >> >>> </div> >> >>> </xforms:repeat> >> >>> >> >>> On xforms-ready I iterate through each subject element and populate >> >>> its >> >>> itemset with this code I have placed in the model: >> >>> >> >>> <xforms:action ev:event="xforms-ready" >> >>> >> >>> xxforms:iterate="instance('guide')/archdesc/controlaccess/subject"> >> >>> <xforms:insert >> >>> context="instance('suggestions-aggregate')" >> >>> nodeset="response" >> >>> origin="instance('response-temp')"/> >> >>> <xforms:setvalue >> >>> >> >>> >> >>> ref="instance('suggestions-aggregate')/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" >> >>> value="context()"/> >> >>> <!--<xforms:dispatch> >> >>> >> >>> </xforms:dispatch>--> >> >>> </xforms:action> >> >>> >> >>> Should I execute the xforms:dispatch while the iteration occurs? >> >>> >> >>> Thanks, >> >>> 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 >> >>> >> >>> >> >> >> >> >> >> >> > >> > >> > -- >> > Scott Prater >> > Library, Instructional, and Research Applications (LIRA) >> > Division of Information Technology (DoIT) >> > University of Wisconsin - Madison >> > [hidden email] >> > >> > >> > -- >> > 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
It does make sense but I have run into a problem with setting the value of the element. I have the following bit of code nested inside of a fr-search-changed action: <xforms:action if="not(string(instance('suggestions-aggregate-department')/response[$uid]/lst[@name='terms']//int[1]))"> <xforms:setvalue ref="instance('guide')/did/materialspec[@type='department'][$uid]" value="$search-value"/> <!--set label--> <xforms:dispatch target="department-autocomplete-control" name="fr-set-label"> <xxforms:context name="label" select="$search-value"/> </xforms:dispatch> </xforms:action> The XPath expression in the @if attribute is correct. I have verified it with some test outputs. $uid is the position. The xforms:dispatch for setting the label also works. The xforms:setvalue, however, does not work as expected. I changed the XPath in the @ref and was able to set the value of other elements in the instance with the $search-value variable. It seems, though, that I cannot set the value of any element that is represented by a dynamic fr:autocomplete. Am I missing something? Is there some sort of "fr-set-value" that I can dispatch? Thanks, Ethan On Fri, Jun 25, 2010 at 9:54 PM, Alessandro Vernet <[hidden email]> wrote: Hi 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 |
I am out of the office until 26th July *********************************************************************************************** This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.
Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.
Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards. *********************************************************************************************** The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG
|
Administrator
|
In reply to this post by Ethan Gruber
Ethan,
You don't want to set the value of the node bound to the <fr:autocomplete>, because this is what the <fr:autocomplete> does, so depending on when you do it, it will override your value. Instead you want to add an item that has the name/value the user searched. Let me take an example (code attached): 1. Your autocomplete is for a list of countries, which you pull down as the user types. 2. Say the user types "United". That is not the name of a country, but you still want to have that information stored in the instance. What do you want in the instance? Say you want what the user typed. 3. So on fr-search-changed, in addition to updating the list, you add an item to the list, with label = value = United. 4. The <fr:autocomplete> will find it, the label matched what the user typed, so it will populate the node with the value for that item (which you also set to United). I hope that this is a bit clearer! Alex On Sat, Jul 10, 2010 at 12:52 PM, Ethan Gruber <[hidden email]> wrote: > Hi Alex, > > It does make sense but I have run into a problem with setting the value of > the element. > > I have the following bit of code nested inside of a fr-search-changed > action: > > <xforms:action > if="not(string(instance('suggestions-aggregate-department')/response[$uid]/lst[@name='terms']//int[1]))"> > <xforms:setvalue > ref="instance('guide')/did/materialspec[@type='department'][$uid]" > value="$search-value"/> > <!--set label--> > <xforms:dispatch target="department-autocomplete-control" > name="fr-set-label"> > <xxforms:context name="label" select="$search-value"/> > > </xforms:dispatch> > </xforms:action> > > The XPath expression in the @if attribute is correct. I have verified it > with some test outputs. $uid is the position. The xforms:dispatch for > setting the label also works. The xforms:setvalue, however, does not work > as expected. I changed the XPath in the @ref and was able to set the value > of other elements in the instance with the $search-value variable. It > seems, though, that I cannot set the value of any element that is > represented by a dynamic fr:autocomplete. Am I missing something? Is there > some sort of "fr-set-value" that I can dispatch? > > Thanks, > Ethan > > On Fri, Jun 25, 2010 at 9:54 PM, Alessandro Vernet <[hidden email]> > wrote: >> >> Hi Ethan, >> >> That's right: the "new" autocomplete won't populate the bound node if >> what users type is not in the itemset. This is tied to the idea that >> what you type is the item's label, and what goes into the node is the >> item's value. It looks like you'd like to have the following logic: if >> there is no item with that label, just do as if there was one, which >> value is equal to the label. >> >> This is something that you can implement: handle the fr-search-changed >> event, and check if there is an item for what the user typed. If there >> isn't: create one setting the label and the value to what the user >> typed. You can then replace the label/value in that item when the user >> types something different, instead of repeatedly adding new items. >> Would this make sense? >> >> Alex >> >> On Fri, Jun 25, 2010 at 6:19 AM, Ethan Gruber <[hidden email]> wrote: >> > Hi Alex, >> > >> > Scott and I (mostly Scott) got it figured out. There is one other issue >> > I >> > have run into with this version of fr:autocomplete versus the version >> > from >> > 3.7.1. If I enter a completely new value into fr:autocomplete that does >> > not >> > match anything returned in a dynamic itemset, the value of the field is >> > not >> > set. This can be a problem when you want to enter new terms that are >> > not >> > part of the current controlled vocabulary. >> > >> > Thanks, >> > Ethan >> > >> > On Thu, Jun 24, 2010 at 8:02 PM, Alessandro Vernet <[hidden email]> >> > wrote: >> >> >> >> Scott, >> >> >> >> I understand this can be a bit confusing. In essence, if you are using >> >> a dynamic itemset, i.e. loading data as users type in the field, then >> >> you can only set the value by setting the label, which is what the >> >> user would have typed. And you do this by dispatching the fr-set-label >> >> event to the autocomplete. Does this make more sense? >> >> >> >> Alex >> >> >> >> On Tue, Jun 1, 2010 at 1:23 PM, Scott Prater <[hidden email]> wrote: >> >> > Hello, Alex -- >> >> > >> >> > I continue to follow in Ethan's footsteps, and now I'm now also >> >> > working >> >> > on >> >> > initializing a dynamic itemset autocomplete field within a repeat. I >> >> > chatted a bit with Ethan offline, and we haven't yet been able to get >> >> > it >> >> > to >> >> > work. We're a bit confused by this paragraph in the wiki: >> >> > >> >> > >> >> > >> >> > http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/autocomplete#TOC-Setting-the-content-of-the-text-fie >> >> > >> >> > "Setting by value >> >> > >> >> > [...] >> >> > >> >> > Don't set the value of the node bound to an autocomplete control if >> >> > you >> >> > are >> >> > using a dynamic itemset. This is because in dynamic itemset mode, you >> >> > load >> >> > the itemset based on the search term entered by users, responding to >> >> > the >> >> > fr-search-changed event. If the value is set, the autocomplete can't >> >> > dispatch a fr-search-changed event, since it doesn't know the label >> >> > yet, >> >> > and >> >> > your code won't load the appropriate itemset that contains the label >> >> > for >> >> > the >> >> > new value. In dynamic itemset mode, always use the fr-set-label event >> >> > to >> >> > indirectly set the value of the control. If you want the autocomplete >> >> > to >> >> > be >> >> > populated based on a value in the instance when the form loads, on >> >> > xforms-model-construct-done you need to find what the label >> >> > corresponding to >> >> > this value is, and dispatch an fr-set-label event with that label." >> >> > >> >> > Do you have a sample XForms snippet that demonstrates how to >> >> > prepopulate >> >> > a >> >> > dynamic itemset autocomplete within a repeat? In particular, showing >> >> > a >> >> > sample instance with a value, a control, and a label that is set to >> >> > the >> >> > value by dispatching an event? >> >> > >> >> > thanks, >> >> > >> >> > -- Scott >> >> > >> >> > Alessandro Vernet wrote: >> >> >> >> >> >> Ethan, >> >> >> >> >> >> It is more complicated than this. I think you hit again a >> >> >> consequence >> >> >> of this limitation: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> http://forge.ow2.org/tracker/index.php?func=detail&aid=314755&group_id=168&atid=350207 >> >> >> >> >> >> I spent quite a bit of time on this one since last week (yep, that >> >> >> limitation really bothered me too), and now you can set the value of >> >> >> an autocomplete control when using the static itemset mode. Note >> >> >> that >> >> >> this won't work in dynamic itemset mode (use the fr-search-changed >> >> >> event in that case) for the reasons exposed here: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/autocomplete#TOC-Setting-by-value >> >> >> >> >> >> This change will be in the next nightly build. >> >> >> >> >> >> Alex >> >> >> >> >> >> On Fri, May 14, 2010 at 7:23 AM, Ethan Gruber <[hidden email]> >> >> >> wrote: >> >> >>> >> >> >>> I am nearly finished my work on autosuggest of Library of Congress >> >> >>> terms >> >> >>> from a Solr index, but there is one final barrier to tackle. When >> >> >>> I >> >> >>> load >> >> >>> my >> >> >>> XML file into my form, the text input of the fr:autocomplete is >> >> >>> blank. >> >> >>> I >> >> >>> am >> >> >>> successfully repopulating my itemset with the element value on >> >> >>> xforms-ready >> >> >>> so that the <li> within fr-autocomplete-yui-div contains the >> >> >>> subject >> >> >>> term, >> >> >>> but this subject term does not appear within the text input itself. >> >> >>> >> >> >>> I think this may be the answer: >> >> >>> >> >> >>> >> >> >>> >> >> >>> http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components#TOC-Setting-the-content-of-the-text-fie >> >> >>> >> >> >>> But I'm not quite clear on the use of xforms:dispatch. Is the >> >> >>> @target >> >> >>> the >> >> >>> id of the fr:autocomplete? What happens when I have two or more >> >> >>> fr:autocompletes in my document since the <subject> element is >> >> >>> repeatable? >> >> >>> >> >> >>> >> >> >>> Here is a stripped down version of my fr:autocomplete code (it >> >> >>> really >> >> >>> just >> >> >>> has the itemset--the rest of the code is nearly identical to the >> >> >>> example >> >> >>> in >> >> >>> the link above): >> >> >>> >> >> >>> <xforms:repeat nodeset="subject"> >> >> >>> <div style="margin-top:10px;display:table;width:100%"> >> >> >>> <xxforms:variable name="uid" select="position()"/> >> >> >>> <fr:autocomplete ref="." dynamic-itemset="true"> >> >> >>> >> >> >>> snip >> >> >>> >> >> >>> <xforms:label >> >> >>> style="float:left">Subject</xforms:label> >> >> >>> <!-- get response from current position in >> >> >>> suggestions-aggregate instance --> >> >> >>> <xforms:itemset >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> nodeset="instance('suggestions-aggregate')/response[$uid]//lst[@name='subject']/int"> >> >> >>> <xforms:label ref="@name"/> >> >> >>> <xforms:value ref="@name"/> >> >> >>> </xforms:itemset> >> >> >>> </fr:autocomplete> >> >> >>> <xforms:trigger appearance="minimal" style="float:left"> >> >> >>> <xforms:delete ev:event="DOMActivate" >> >> >>> >> >> >>> nodeset="instance('suggestions-aggregate')/response[$uid]"/> >> >> >>> <xforms:delete ev:event="DOMActivate" nodeset="."/> >> >> >>> <xforms:label> >> >> >>> <img src="/apps/ead/images/remove.gif"/> >> >> >>> </xforms:label> >> >> >>> </xforms:trigger> >> >> >>> </div> >> >> >>> </xforms:repeat> >> >> >>> >> >> >>> On xforms-ready I iterate through each subject element and populate >> >> >>> its >> >> >>> itemset with this code I have placed in the model: >> >> >>> >> >> >>> <xforms:action ev:event="xforms-ready" >> >> >>> >> >> >>> xxforms:iterate="instance('guide')/archdesc/controlaccess/subject"> >> >> >>> <xforms:insert >> >> >>> context="instance('suggestions-aggregate')" >> >> >>> nodeset="response" >> >> >>> origin="instance('response-temp')"/> >> >> >>> <xforms:setvalue >> >> >>> >> >> >>> >> >> >>> >> >> >>> ref="instance('suggestions-aggregate')/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" >> >> >>> value="context()"/> >> >> >>> <!--<xforms:dispatch> >> >> >>> >> >> >>> </xforms:dispatch>--> >> >> >>> </xforms:action> >> >> >>> >> >> >>> Should I execute the xforms:dispatch while the iteration occurs? >> >> >>> >> >> >>> Thanks, >> >> >>> 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 >> >> >>> >> >> >>> >> >> >> >> >> >> >> >> >> >> >> > >> >> > >> >> > -- >> >> > Scott Prater >> >> > Library, Instructional, and Research Applications (LIRA) >> >> > Division of Information Technology (DoIT) >> >> > University of Wisconsin - Madison >> >> > [hidden email] >> >> > >> >> > >> >> > -- >> >> > 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 > > -- 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 autocomplete-unittest.xhtml (10K) Download Attachment
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
I am out of the office until 26th July *********************************************************************************************** This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.
Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.
Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards. *********************************************************************************************** The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG
|
In reply to this post by Alessandro Vernet
Ah, makes sense now. Got it working! That was the last issue I was having with dynamic autocompletes. I'll try to get to work on the Solr interoperability wiki page soon.
Ethan
On Tue, Jul 13, 2010 at 9:35 PM, Alessandro Vernet <[hidden email]> wrote: 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 |
I am out of the office until 26th July *********************************************************************************************** This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.
Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.
Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards. *********************************************************************************************** The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG
|
Administrator
|
In reply to this post by Ethan Gruber
Ethan,
OK, excellent; I am glad this technique did indeed work in your case. Alex On Monday, July 19, 2010, Ethan Gruber <[hidden email]> wrote: > Ah, makes sense now. Got it working! That was the last issue I was having with dynamic autocompletes. I'll try to get to work on the Solr interoperability wiki page soon. > > Ethan > > > On Tue, Jul 13, 2010 at 9:35 PM, Alessandro Vernet <[hidden email]> wrote: > > Ethan, > > You don't want to set the value of the node bound to the > <fr:autocomplete>, because this is what the <fr:autocomplete> does, so > depending on when you do it, it will override your value. Instead you > want to add an item that has the name/value the user searched. Let me > take an example (code attached): > > 1. Your autocomplete is for a list of countries, which you pull down > as the user types. > 2. Say the user types "United". That is not the name of a country, but > you still want to have that information stored in the instance. What > do you want in the instance? Say you want what the user typed. > 3. So on fr-search-changed, in addition to updating the list, you add > an item to the list, with label = value = United. > 4. The <fr:autocomplete> will find it, the label matched what the user > typed, so it will populate the node with the value for that item > (which you also set to United). > > I hope that this is a bit clearer! > > Alex > > On Sat, Jul 10, 2010 at 12:52 PM, Ethan Gruber <[hidden email]> wrote: >> Hi Alex, >> >> It does make sense but I have run into a problem with setting the value of >> the element. >> >> I have the following bit of code nested inside of a fr-search-changed >> action: >> >> <xforms:action >> if="not(string(instance('suggestions-aggregate-department')/response[$uid]/lst[@name='terms']//int[1]))"> >> <xforms:setvalue >> ref="instance('guide')/did/materialspec[@type='department'][$uid]" >> value="$search-value"/> >> <!--set label--> >> <xforms:dispatch target="department-autocomplete-control" >> name="fr-set-label"> >> <xxforms:context name="label" select="$search-value"/> >> >> </xforms:dispatch> >> </xforms:action> >> >> The XPath expression in the @if attribute is correct. I have verified it >> with some test outputs. $uid is the position. The xforms:dispatch for >> setting the label also works. The xforms:setvalue, however, does not work >> as expected. I changed the XPath in the @ref and was able to set the value >> of other elements in the instance with the $search-value variable. It >> seems, though, that I cannot set the value of any element that is >> represented by a dynamic fr:autocomplete. Am I missing something? Is there >> some sort of "fr-set-value" that I can dispatch? >> >> Thanks, >> Ethan >> >> On Fri, Jun 25, 2010 at 9:54 PM, Alessandro Vernet <[hidden email]> >> wrote: >>> >>> Hi Ethan, >>> >>> That's right: the "new" autocomplete won't populate the bound node if >>> what users type is not in the itemset. This is tied to the idea that >>> what you type is the item's label, and what goes into the node is the >>> item's value. It looks like you'd like to have the following logic: if >>> there is no item with that label, just do as if there was one, which >>> value is equal to the label. >>> >>> This is something that you can implement: handle the fr-search-changed >>> event, and check if there is an item for what the user typed. If there >>> isn't: create one setting the label and the value to what the user >>> typed. You can then replace the label/value in that item when the user >>> types something different, instead of repeatedly adding new items. >>> Would this make sense? >>> >>> Alex >>> >>> On Fri, Jun 25, 2010 at 6:19 AM, Ethan Gruber <[hidden email]> wrote: >>> > Hi Alex, >>> > >>> > Scott and I (mostly Scott) got it figured out. There is one other issue >>> > I >>> > have run into with this version of fr:autocomplete versus the version >>> > from >>> > 3.7.1. If I enter a completely new value into fr:autocomplete that does >>> > not >>> > match anything retu 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 |
I am out of the office until 26th July *********************************************************************************************** This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.
Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.
Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards. *********************************************************************************************** The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG
|
Free forum by Nabble | Edit this page |