1. Create a form with a ModelChoiceField and a ForeignKeySearchInput widget
2. Use it with a formset
3. You get a JS error for every autocomplete field.
What is the expected output? What do you see instead?
The problem resides on a variable name, it uses the field name and it is
OK, but when using it on a formset, behind the scenes, Django renames the
fields in the html output and prefixes it with the form index, separated by
dashes. That's the problem, dashes are not valid in JS identifiers.
I create a simple template filter that replaces dashes with "__dash__" and
use it on the widget template ONLY where the field name is used as a JS
identifier, not where it's used as a JQuery selector. That make it work.
What version of the product are you using? On what operating system?
Development (git pull origin master) Ubuntu 9.04
Please provide any additional information below.
Original issue reported on code.google.com by gmandx on 2 Jun 2009 at 3:40
Original issue reported on code.google.com by
gmandx
on 2 Jun 2009 at 3:40Attachments: