It is doing two callbacks, one to get autocomplete options and one
when you click an item. It seems like it shouldn't do the second one.
Also, it probably shouldn't submit the form if you hit the enter key
while selecting an option. You might try breaking that huge js code on
attr['_onkeyup'] into smaller more digestible pieces to see what's
going on :)

There should really be a widget script resource section in
web2py_ajax.html so that widget makers can include global functions
and styles that multiple instances of a widget can use.  Kind of like
response.files but raw code instead of file includes. Maybe just a
blank jQuery(document).ready function at the end of web2py_ajax.html
that renders a list called response.ready. Putting it at the end will
keep user code from breaking necessary framework code. Thoughts?


On Feb 7, 10:34 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Please give it a try. It seems some time requires double click instead
> of single click but cannot figure out why.
>
> On Feb 7, 8:52 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > Looking good but now I can't select an unselected option by clicking.
> > I can only select the currently selected option with a mouse click.
>
> > On Feb 7, 8:34 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > Now it is very customizable and works well, including right, up, down
> > > arrows. It requires at least two chars to start the ajax calls.
>
> > > just do
>
> > > db.table.field.widget=AutocompleteWidget(request,db.othertable.name,db.othertable.id)
>
> > > it looks up in field "name" for the value of "id".
>
> > > On Feb 7, 3:12 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > Nice! I like this but I think it needs a few more tweaks. Can you
> > > > modify it to allow the arrow keys to select an item? Also, when you
> > > > clear the input after typing something, all of the options show.
>
> > > > I personally think that javascript should be used more in the
> > > > framework (with proper attention paid so that things degrade
> > > > gracefully when it's off).
>
> > > > On Feb 7, 2:11 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > How about we change IS_IN_DB so that, if the number of referenced
> > > > > records exceeds a maximum the auto complete widget is on by default?
>
> > > > > Massimo
>
> > > > > On Feb 7, 1:02 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > > I do not know that. I am still playing with it...
>
> > > > > > On Feb 6, 11:40 pm, Jason Brower <encomp...@gmail.com> wrote:
>
> > > > > > > I have my current autocomplete but it doesn't do öäå in a search. 
> > > > > > >  Does
> > > > > > > this handle that?
> > > > > > > Best Regards,
> > > > > > > Jason
>
> > > > > > > On Sat, 2010-02-06 at 12:30 -0800, mdipierro wrote:
> > > > > > > > People say there is some magic in web2py.
> > > > > > > > Here is some real magic now in trunk that I am sure you have 
> > > > > > > > never
> > > > > > > > seen.
>
> > > > > > > > Caveats:
> > > > > > > > 0) requires latest trunk (bzr 1603, hg 175:e42b559254f6)
> > > > > > > > 1) this is an experiment, not sure it is a good idea
> > > > > > > > 2) this is the first function in web2py that REQUIRES jQuery
> > > > > > > > 3) works but I am not yet convinced it should stay there
> > > > > > > > 4) even if it stays, I am sure the API should stay
>
> > > > > > > > Example:
>
> > > > > > > > ### assume this model
> > > > > > > > db.define_table('target',Field('name'))
> > > > > > > > if not db(db.target.id>0).count():
> > > > > > > >     db.target.insert(name="Klingon")
> > > > > > > >     db.target.insert(name="Romulans")
> > > > > > > >     db.target.insert(name="Borg")
> > > > > > > >     db.target.insert(name="Borg2")
> > > > > > > > db.define_table('photon_torpedo',Field('target',db.target))
>
> > > > > > > > ### assume this action in controller default.py
> > > > > > > > def launch():
> > > > > > > >     db.photon_torpedo.target.represent=lambda target: 
> > > > > > > > target.name
> > > > > > > >     return dict(new_torpedo=crud.create(db.photon_torpedo),
> > > > > > > >                 
> > > > > > > > launched_torpedos=db().select(db.photon_torpedo.ALL))
>
> > > > > > > > So far nothing new.
>
> > > > > > > > Now append to the model or insert at top of controller the 
> > > > > > > > following:
>
> > > > > > > > from gluon.sqlhtml import AutocompleteWidget
> > > > > > > > db.photon_torpedo.target.widget=AutocompleteWidget(request,db.target.name,db.target.id)
>
> > > > > > > > No need to define any callback action (there is no callback 
> > > > > > > > action!)
> > > > > > > > No plugin required (perhaps some optional css to style).
> > > > > > > > No js coding required.
> > > > > > > > Applies to existing apps, including those that use custom forms.
>
> > > > > > > > Let's see who can figure out how it works!
>
> > > > > > > > Massimo
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to