Re: AJAX Autocompletion Field
I'll just point out that the jQuery Autocomplete plugin is included (will be included) in the next jQueryUI release. I think it's been pretty easy to hook into views On Feb 15, 2010 6:00 AM, "Massimiliano della Rovere" < massimiliano.dellarov...@gmail.com> wrote: I'd use http://dajaxproject.com/ On Sun, Feb 14, 2010 at 06:36, Margie Roginskiwrote: > Hi Jon, > > I h... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: AJAX Autocompletion Field
I'd use http://dajaxproject.com/ On Sun, Feb 14, 2010 at 06:36, Margie Roginskiwrote: > Hi Jon, > > I have used this very successfully: > > http://loopj.com/2009/04/25/jquery-plugin-tokenizing-autocomplete-text-entry/ > > The demo is here: > > http://loopj.com/tokeninput/demo.html > > One thing that differentiates it from the jquery autocomplete package > is that it allows you to specify multiple selections, which was > something I needed. It also comes with css that gives it a very nice > look and feel. > > I had almost no jquery experience at the time I started with it and > was able to get it to work very well. That said, there are a bunch of > people that continue to ask for help or report problems, and the > author doesn't really seem to respond, so it is not well supported and > if you need enhancements, you have to dive in and understand the code. > > Margie > > > > > On Feb 13, 2:46 pm, Jon Loeliger wrote: >> Folks, >> >> For likely the umpteenth time, can someone recommend a good >> AJAX auto completion tutorial or example that I might use >> to crib-together a text-field selection that would otherwise >> be a very large drop-down selection field? >> >> My use case would be essentially like having a table full >> of say, recipie ingredients, and letting the user select >> which one to add into a recipe. I'd like to have the user >> simply start typing a few first characters and then let an >> autocompleter search for matches and present them to the user. >> The source of the matches would be a "Name" TextField in >> some model. >> >> What is the current Best Practice or even Good Advice? :-) >> Pros and cons for jQuery or extjs or something else? >> A good "How To" or a pointer to a write up? >> >> Thanks, >> jdl > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: AJAX Autocompletion Field
Hi Jon, I have used this very successfully: http://loopj.com/2009/04/25/jquery-plugin-tokenizing-autocomplete-text-entry/ The demo is here: http://loopj.com/tokeninput/demo.html One thing that differentiates it from the jquery autocomplete package is that it allows you to specify multiple selections, which was something I needed. It also comes with css that gives it a very nice look and feel. I had almost no jquery experience at the time I started with it and was able to get it to work very well. That said, there are a bunch of people that continue to ask for help or report problems, and the author doesn't really seem to respond, so it is not well supported and if you need enhancements, you have to dive in and understand the code. Margie On Feb 13, 2:46 pm, Jon Loeligerwrote: > Folks, > > For likely the umpteenth time, can someone recommend a good > AJAX auto completion tutorial or example that I might use > to crib-together a text-field selection that would otherwise > be a very large drop-down selection field? > > My use case would be essentially like having a table full > of say, recipie ingredients, and letting the user select > which one to add into a recipe. I'd like to have the user > simply start typing a few first characters and then let an > autocompleter search for matches and present them to the user. > The source of the matches would be a "Name" TextField in > some model. > > What is the current Best Practice or even Good Advice? :-) > Pros and cons for jQuery or extjs or something else? > A good "How To" or a pointer to a write up? > > Thanks, > jdl -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: AJAX Autocompletion Field
I don't know of any cons regarding jQuery, unless the others who you work with or communicate with all use something else. Here's a fully-working example (from which you can easily create yours). It's not exactly a tutorial, but it should be all you need. http://docs.jquery.com/Plugins/Autocomplete If you're looking for best-practices for integrating it with Django, then maybe someone can chime in. For speed it's obviously a good idea to have the data on the page if you can, although that can lead to large pages. Add Django's gzip middleware to help with that. I like using views that return JSON and just have the JavaScript work with that, but I'm doing things a little less "visual" than auto-complete. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: AJAX Autocompletion Field
There probably isnt a good whole tutorial. Which looks at the operation from client side to server side... You should read about writing your own autocomplete field in JS. And for server side look at writing a view which returns a JSON or list of options which corresponds with the JS / JS framework you are using. I dont think there is a best practice, basically all autocomplete forms are a hack made to look like a menu appearing under a form field. Below is an example using prototype/ scriptalicious client side. Read: http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleter Django Forms Component: class MyForm(forms.Form): myAutocompleteField = forms.CharFIeld(max_length=80, required=True, widget=forms.TextInput(attrs={'autocomplete':"off", "onkeyup":"nameOfJavascriptMethod('arg1', 'arg2', this.value);", 'size':'35'})) Template Part of a form template: Turning on Javascript will help you complete this field by providing suggestions! {{form.myAutocompleteField}} {{form.myAutocompleteField.errors}} Javascript: function postcodeLocationEvent(txtfieldid, resultsdivid, value) { new_url = '/findmyautocompletestr/'; new Ajax.Autocompleter(txtfieldid, resultsdivid, new_url, { method: 'post', paramName: 'locationinput', minChars: 3, parameters: {'locationinput':value}, indicator: 'indicator1' }); } View: def getLocationViaSuburbOrPostcode(request): #basically whatever you model is storing, some access query probably using startswith or contains loc_af = postcodeorsuburbfind(request) # would be Model.objects.filter(somefield__istartswith=.POST['someParameter']).values('') places = [] places.append('') if loc_af is None: return HttpResponse(status=500) if len(loc_af) is 0: return HttpResponse(status=500) for l in loc_af: if l.has_key('airfield_name'): if l.has_key('ycode'): #in this example just formatting html to be compliant with the scriptalicious API for autocompleter places.append('%s,%s,%s,%s'%(l['airfield_postcode'],l['airfield_name'],l['ycode'],l['state__state_abbrev'])) else: places.append('%s,%s,ALA,%s'%(l['airfield_postcode'],l['airfield_name'],l['state__state_abbrev'])) else: places.append('%s,%s,%s'%(l['postcode'],l['suburb'],l['state__state_abbrev'])) places.append('') return HttpResponse(places) Thats absically it. You can choose to write your own JS for the autocompleter, its a lot of work, i wrote my own but current project is using prototype+scriptalicious so i dont bother using it. cheers -sam On Sun, Feb 14, 2010 at 9:46 AM, Jon Loeligerwrote: > Folks, > > For likely the umpteenth time, can someone recommend a good > AJAX auto completion tutorial or example that I might use > to crib-together a text-field selection that would otherwise > be a very large drop-down selection field? > > My use case would be essentially like having a table full > of say, recipie ingredients, and letting the user select > which one to add into a recipe. I'd like to have the user > simply start typing a few first characters and then let an > autocompleter search for matches and present them to the user. > The source of the matches would be a "Name" TextField in > some model. > > What is the current Best Practice or even Good Advice? :-) > Pros and cons for jQuery or extjs or something else? > A good "How To" or a pointer to a write up? > > Thanks, > jdl > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.