Hello,
I am trying to use the autocomplete widget as outlined in the cookbook
here:
http://turbogears.org/2.0/docs/main/ToscaWidgets/Cookbook/AutoComplete.html
I'm using:
FireFox 3.5.5
TG2.0
tw.jquery 0.9.5
Here is the field within my form:
fields = [
...
AutoCompleteField('Customer', label_text = 'Customer', completionURL='/
dispatch/getCustomers', fetchJSON=True, minChars=1),
...
]
Here is my sample controller:
@expose('json')
def getCustomers(self, **kw):
log.debug("============== Dispatcher.getCustomers()
======================")
print kw
states = ['ALASKA', 'ALABAMA', 'ARIZONA', 'WYOMING']
return dict(data=states)
Upon opening the form FireBug, gives me an illegal character error and
getCustomers is not called.
Generated js looks like:
$.getJSON("/dispatch/getCustomers", function(data) {$
(\"#edit_order_form_Customer\").autocomplete(data[\"data\"]);})
I saw the note posted by kvdb (In the comments of the howto) about the
quote correction:
http://toscawidgets.org/trac/tw.jquery/ticket/6
When I modify autocomplete.py with his new code, getCustomers is
calles, but I get a new FireBug error:
$("#edit_order_form_Customer").autocomplete is not a function
with generated js:
$.getJSON("/dispatch/getCustomers", function(data) {$
('#edit_order_form_Customer').autocomplete(data['data']);})
It seems to not be finding the autocomplete.js file. Any ideas?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---