autocomplete doesn't work for newly inserted rows

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

autocomplete doesn't work for newly inserted rows

kamal-2

I have a select1 control with autocomplete as part of a repeat element. The autocomplete works for existing elements , but doesn't work for newly inserted rows.

Find below the link to a reproducible test case. To reproduce click on the add button and check if auto complete works for the city column.

repeat-autocomplete-issue.xhtml

I have tried it with the 28 November snapshot build.

Thanks for the help.

If this is bug please provide me some pointer on where to start debugging, I will try and attempt to fix it.

Regards,
Kamal
Reply | Threaded
Open this post in threaded view
|

Re: autocomplete doesn't work for newly inserted rows

Alessandro  Vernet
Administrator
Kamal,

Well, it looks I fixed this just a few weeks ago. But now I can see it
not working in your example, and looking at the xforms.js can't see
how it could have worked before. I am puzzled. (Time to get another
coffee!) I re-opened this bug:

http://forge.objectweb.org/tracker/?group_id=168&atid=350207&func=detail&aid=306390

If you want to have a look at the code, everything is in xforms.js.
The function _autoComplete() must called to initialize auto-complete
controls. It gets called for controls that are there when the page is
loaded, but not for new auto-complete added after an insertion in a
repeat.

If you want to try to fix this, you would only have to change
xforms.js. Under case "copy-repeat-template" we need to go through the
sub-tree we have just copied, look for controls that need to be
initialized, and initialize those by calling the appropriate function
in ORBEON.xforms.Init.

Let us know if you have any question.

Alex

On 12/5/06, Kamal <[hidden email]> wrote:

>
>
> I have a select1 control with autocomplete as part of a repeat element. The
> autocomplete works for existing elements , but doesn't work for newly
> inserted rows.
>
> Find below the link to a reproducible test case. To reproduce click on the
> add button and check if auto complete works for the city column.
>
> http://www.nabble.com/file/4467/repeat-autocomplete-issue.xhtml
> repeat-autocomplete-issue.xhtml
>
> I have tried it with the 28 November snapshot build.
>
> Thanks for the help.
>
> If this is bug please provide me some pointer on where to start debugging, I
> will try and attempt to fix it.
>
> Regards,
> Kamal
> --
> View this message in context: http://www.nabble.com/autocomplete-doesn%27t-work-for-newly-inserted-rows-tf2761145.html#a7698012
> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>
>
>
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: autocomplete doesn't work for newly inserted rows

kamal-2
Thanks Alex.

I tried debugging this by comparing the HTML & DOM node for the existing & the newly added row. The main difference was that the new node didn't have the actb_* attributes (other than the keyword values).  For the existing rows this is being setup in the ORBEON.xforms.Init._autoComplete function when the document is loaded.

I modified the xforms.js to call the _autoComplete function for the newly added element. I also tried just invoking the actb directly as done in the _autoComplete method. Both these changes fix the problem.  I don't think this is the correct way of fixing it, but it might help you in finding a better fix.

The following is the modification I tried.

<code>
function xformsHandleResponse(o)
...
...
                // Second handle the <xxforms:itemsets> actions (we want to do this before we set the value of
                // controls as the value of the select might be in the new values of the itemset).
                    ...
                    ....
                                if (ORBEON.util.Dom.hasClass(documentElement, "xforms-select1-open")) {

                                   // Begin modification by Kamal
                                   ORBEON.xforms.Init._autoComplete(documentElement);
                                   // End modificaiton by Kamal

                                    // Build list with new values
                                    var newValues = new Array();
                                    for (var k = 0; k < itemsetElement.childNodes.length; k++) {
                                        var itemElement = itemsetElement.childNodes[k];
                                        if (itemElement.nodeType == ELEMENT_TYPE)
                                            newValues.push(ORBEON.util.Dom.getAttribute(itemElement, "value"));
                                    }

                                    // Case of the auto-complete control
                                    var textfield = ORBEON.util.Dom.getChildElement(documentElement, 0);
                                    textfield.actb_keywords = newValues;
</code>

Regards,
Kamal

avernet wrote
Kamal,

Well, it looks I fixed this just a few weeks ago. But now I can see it
not working in your example, and looking at the xforms.js can't see
how it could have worked before. I am puzzled. (Time to get another
coffee!) I re-opened this bug:

http://forge.objectweb.org/tracker/?group_id=168&atid=350207&func=detail&aid=306390

If you want to have a look at the code, everything is in xforms.js.
The function _autoComplete() must called to initialize auto-complete
controls. It gets called for controls that are there when the page is
loaded, but not for new auto-complete added after an insertion in a
repeat.

If you want to try to fix this, you would only have to change
xforms.js. Under case "copy-repeat-template" we need to go through the
sub-tree we have just copied, look for controls that need to be
initialized, and initialize those by calling the appropriate function
in ORBEON.xforms.Init.

Let us know if you have any question.

Alex

On 12/5/06, Kamal <kamal_gs@yahoo.com> wrote:
>
>
> I have a select1 control with autocomplete as part of a repeat element. The
> autocomplete works for existing elements , but doesn't work for newly
> inserted rows.
>
> Find below the link to a reproducible test case. To reproduce click on the
> add button and check if auto complete works for the city column.
>
> http://www.nabble.com/file/4467/repeat-autocomplete-issue.xhtml
> repeat-autocomplete-issue.xhtml
>
> I have tried it with the 28 November snapshot build.
>
> Thanks for the help.
>
> If this is bug please provide me some pointer on where to start debugging, I
> will try and attempt to fix it.
>
> Regards,
> Kamal
> --
> View this message in context: http://www.nabble.com/autocomplete-doesn%27t-work-for-newly-inserted-rows-tf2761145.html#a7698012
> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>
>
>
>
>
> --
> You receive this message as a subscriber of the ops-users@objectweb.org mailing list.
> To unsubscribe: mailto:ops-users-unsubscribe@objectweb.org
> For general help: mailto:sympa@objectweb.org?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>


--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the ops-users@objectweb.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@objectweb.org
For general help: mailto:sympa@objectweb.org?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: autocomplete doesn't work for newly inserted rows

Alessandro  Vernet
Administrator
Kamal,

This is one way of doing it: every time we receive the value for a
auto-complete field we initialize that field. But this is kind of a
hack :). If we do this, we will initialize those fields more often
than we need to.

Instead, I would prefer if we could have some code under the case
"copy-repeat-template" which initializes the auto-complete fields if
needed as they are copied. When we create a copy of the template (var
nodeCopy = templateNode.cloneNode(true);), we already go through the
tree to change ids calling xformsAddSuffixToIds(). We would need a
similar function that navigates the tree and and initializes the
auto-completes it finds.

Alex

On 12/12/06, Kamal <[hidden email]> wrote:

>
> Thanks Alex.
>
> I tried debugging this by comparing the HTML & DOM node for the existing &
> the newly added row. The main difference was that the new node didn't have
> the actb_* attributes (other than the keyword values).  For the existing
> rows this is being setup in the ORBEON.xforms.Init._autoComplete function
> when the document is loaded.
>
> I modified the xforms.js to call the _autoComplete function for the newly
> added element. I also tried just invoking the actb directly as done in the
> _autoComplete method. Both these changes fix the problem.  I don't think
> this is the correct way of fixing it, but it might help you in finding a
> better fix.
>
> The following is the modification I tried.
>
> <code>
> function xformsHandleResponse(o)
> ...
> ...
>                 // Second handle the <xxforms:itemsets> actions (we want to
> do this before we set the value of
>                 // controls as the value of the select might be in the new
> values of the itemset).
>                     ...
>                     ....
>                                 if
> (ORBEON.util.Dom.hasClass(documentElement, "xforms-select1-open")) {
>
>                                    // Begin modification by Kamal
>                                    ORBEON.xforms.Init._autoComplete(documentElement);
>                                    // End modificaiton by Kamal
>
>                                     // Build list with new values
>                                     var newValues = new Array();
>                                     for (var k = 0; k <
> itemsetElement.childNodes.length; k++) {
>                                         var itemElement =
> itemsetElement.childNodes[k];
>                                         if (itemElement.nodeType ==
> ELEMENT_TYPE)
>
> newValues.push(ORBEON.util.Dom.getAttribute(itemElement, "value"));
>                                     }
>
>                                     // Case of the auto-complete control
>                                     var textfield =
> ORBEON.util.Dom.getChildElement(documentElement, 0);
>                                     textfield.actb_keywords = newValues;
> </code>
>
> Regards,
> Kamal
>
>
> avernet wrote:
> >
> > Kamal,
> >
> > Well, it looks I fixed this just a few weeks ago. But now I can see it
> > not working in your example, and looking at the xforms.js can't see
> > how it could have worked before. I am puzzled. (Time to get another
> > coffee!) I re-opened this bug:
> >
> > http://forge.objectweb.org/tracker/?group_id=168&atid=350207&func=detail&aid=306390
> >
> > If you want to have a look at the code, everything is in xforms.js.
> > The function _autoComplete() must called to initialize auto-complete
> > controls. It gets called for controls that are there when the page is
> > loaded, but not for new auto-complete added after an insertion in a
> > repeat.
> >
> > If you want to try to fix this, you would only have to change
> > xforms.js. Under case "copy-repeat-template" we need to go through the
> > sub-tree we have just copied, look for controls that need to be
> > initialized, and initialize those by calling the appropriate function
> > in ORBEON.xforms.Init.
> >
> > Let us know if you have any question.
> >
> > Alex
> >
> > On 12/5/06, Kamal <[hidden email]> wrote:
> >>
> >>
> >> I have a select1 control with autocomplete as part of a repeat element.
> >> The
> >> autocomplete works for existing elements , but doesn't work for newly
> >> inserted rows.
> >>
> >> Find below the link to a reproducible test case. To reproduce click on
> >> the
> >> add button and check if auto complete works for the city column.
> >>
> >> http://www.nabble.com/file/4467/repeat-autocomplete-issue.xhtml
> >> repeat-autocomplete-issue.xhtml
> >>
> >> I have tried it with the 28 November snapshot build.
> >>
> >> Thanks for the help.
> >>
> >> If this is bug please provide me some pointer on where to start
> >> debugging, I
> >> will try and attempt to fix it.
> >>
> >> Regards,
> >> Kamal
> >> --
> >> View this message in context:
> >> http://www.nabble.com/autocomplete-doesn%27t-work-for-newly-inserted-rows-tf2761145.html#a7698012
> >> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
> >>
> >>
> >>
> >>
> >>
> >> --
> >> 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
> >> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
> >>
> >>
> >>
> >
> >
> > --
> > Blog (XML, Web apps, Open Source):
> > http://www.orbeon.com/blog/
> >
> >
> >
> > --
> > 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
> > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
> >
> >
>
> --
> View this message in context: http://www.nabble.com/autocomplete-doesn%27t-work-for-newly-inserted-rows-tf2761145.html#a7829604
> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>
>
>
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet