Very good Annet, glad to be of help.
> return ‘’.join([DIV(k,_onclick=”$(‘#plaatsnaam’).attr
> (‘value’,’%s’)”%k).xml() for k in selected])
This creates a series of DIVs with the values returned by the ajax
call (these are the options of the autocomplete that you see) and sets
each option onclick event to transfer the value to the autocomplete
element (#plaatsnaam) when clicked.
> _onkeyup="ajax('ctl_that_returns_plaatsnaamlist',
> ['plaatsnaam'],'plaatsnaamlist')"),DIV(_id="plaatsnaamlist")
Sets the onkeyup event of the element to call the ajax function (which
you can find inside web2py_ajax.html). The func arguments are:
1) url of controller function to call,
2) list of arguments to pass,
3) id of the element whose innerHTML gets replaced with the ajax
response (in this case the following DIV).
Note: the ajax func in web2py calls jQuery's ajax which has more
options.
> In the web2py manual, Massimo mentions a jQuery auto-complete plugin,
> at the jQuery site I found 4 of them, however, I haven't got a clue
> whether I am better of using a plugin than using a widget , what do
> you think?
The widget is needed independently of the plugin selected, what varies
is the setup required to get the plugin working. Since there are
several autocomplete plugins available you would have to choose the
one that fits your needs best.
My choice and how-to are in this thread:
http://groups.google.com/group/web2py/browse_thread/thread/e1034df0091b5bfd#
> The byplace() function resides in a clubs controller, together with
> byactivity and byfacility functions which are similar in
> functionality. Since I also need the auto-complete field in an event
> list controller I wonder where to put the
> ctl_that_returns_plaatsnaamlist() function. In my models I have got a
> db.py with table definitions and a navigation.py with application and
> controller menus, so, is it a good idea to create a .py file in my
> models and put the ctl_that_returns_plaatsnaamlist() function in
> there?
The ctl_that_returns_plaatsnaamlist() has to be a function inside a
controller (the name is a bit misleading) as in:
.../application/controller/ctl_that_returns_plaatsnaamlist/...
we are just lucky that the ajax func fills in the blanks somewhere.
You could define a function in a model file and call it from the
ctl_that_returns_plaatsnaamlist to have only one defined, just be
careful with element ids.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---