name-one additional functionality

33 views
Skip to first unread message

tonym

unread,
Dec 4, 2012, 8:52:55 AM12/4/12
to hobo...@googlegroups.com
Hi All,
two features I'm looking to achieve, and I can't see how to use name-one to achieve it.  May be these are enhancements to name-one?...

1. I need name-one to behave as normal if the user selects from the list, but if they just type something in that is not in the autocomplete list, then I need to detect this (with jquery ideally) and reveal a sub-form (in hidden div) to gather the info to create a new record (adding to that autocomplete list for future).  Does name-one fire javascript that I can hook in to?

2. If the user selects from the autocomplete list then I need more than one field from that record (e.g. I need to populate name as normal and then pre-populate another field with email address, from the autocomplete record just selected).

If not possible out of the box, then I think these are much needed features

Cheers, Anthony.

Bryan Larsen

unread,
Dec 4, 2012, 9:22:47 AM12/4/12
to hobo...@googlegroups.com
On Tue, Dec 4, 2012 at 8:52 AM, tonym <blymi...@gmail.com> wrote:
> Hi All,
> two features I'm looking to achieve, and I can't see how to use name-one to
> achieve it. May be these are enhancements to name-one?...
>
> 1. I need name-one to behave as normal if the user selects from the list,
> but if they just type something in that is not in the autocomplete list,
> then I need to detect this (with jquery ideally) and reveal a sub-form (in
> hidden div) to gather the info to create a new record (adding to that
> autocomplete list for future). Does name-one fire javascript that I can
> hook in to?

Which name-one are you using? The script.aculo.us one from 1.3,
hobo_jquery_ui or hobo_bootstrap_ui? The latter two fire events,
check the documentation for the underlying toolkit for more details.

>
> 2. If the user selects from the autocomplete list then I need more than one
> field from that record (e.g. I need to populate name as normal and then
> pre-populate another field with email address, from the autocomplete record
> just selected).
>

a hot-input wrapper should be able to accomplish that. Check the
documentation for hot-input, and come back if you have any questions.

Bryan

Matt Jones

unread,
Dec 4, 2012, 3:58:11 PM12/4/12
to hobo...@googlegroups.com

On Dec 4, 2012, at 8:52 AM, tonym wrote:

> Hi All,
> two features I'm looking to achieve, and I can't see how to use name-one to achieve it. May be these are enhancements to name-one?...
>
> 1. I need name-one to behave as normal if the user selects from the list, but if they just type something in that is not in the autocomplete list, then I need to detect this (with jquery ideally) and reveal a sub-form (in hidden div) to gather the info to create a new record (adding to that autocomplete list for future). Does name-one fire javascript that I can hook in to?

@Bryan, regarding this - didn't you add something like this to select-one?

--Matt Jones

tonym

unread,
Dec 4, 2012, 5:03:11 PM12/4/12
to hobo...@googlegroups.com
Thanks Bryan,

Which name-one are you using?   The script.aculo.us one from 1.3,
hobo_jquery_ui or hobo_bootstrap_ui?  The latter two fire events,
check the documentation for the underlying toolkit for more details.

I'm using hobo_bootstrap_ui  tried finding something in the docs but haven't spotted it - will look again.
 

a hot-input wrapper should be able to accomplish that.   Check the
documentation for hot-input, and come back if you have any questions.

Don't know why hadn't thought of that!  Will give that a go. 

Thanks. Anthony.

Bryan Larsen

unread,
Dec 5, 2012, 8:05:28 AM12/5/12
to hobo...@googlegroups.com
Hmm, I did make a hacky select-one-or-new-dialog which doesn't do
exactly what Tony wants, but it could serve as a guide. Ignacio also
added one to hobo_bootstrap_ui, which works better.

Bryan

Bryan Larsen

unread,
Dec 5, 2012, 8:07:36 AM12/5/12
to hobo...@googlegroups.com
On Tue, Dec 4, 2012 at 5:03 PM, tonym <blymi...@gmail.com> wrote:
> Thanks Bryan,
>
>> Which name-one are you using? The script.aculo.us one from 1.3,
>> hobo_jquery_ui or hobo_bootstrap_ui? The latter two fire events,
>> check the documentation for the underlying toolkit for more details.
>
>
> I'm using hobo_bootstrap_ui tried finding something in the docs but haven't
> spotted it - will look again.
>

You're right, they don't appear to be firing custom events:

http://twitter.github.com/bootstrap/javascript.html#typeahead

You should be able to hook into change events on one of the subcomponents.

Or you can use the jQuery-UI based version:

http://api.jqueryui.com/autocomplete/

Bryan
Reply all
Reply to author
Forward
0 new messages