开发者

jQuery Autocomplete / django-ajax-selects: how to add selected item to a display area, and to allow creating new item?

I want to provide an Autocomplete feature that's similar to the example provided by django-ajax-selects:

  1. user types apartment name in a textbox, a list of autocomplete suggestions is provided. Each suggestion includes unique_id, name, image, address, etc.

  2. user can select from the list of suggestions. Once selected, details of that apartment is added to a display area below the textbox. There's also a "delete" icon to delete a selected apartment

  3. If there's no match from the existing apartments in the database, user can create a new apartment

  4. When the form is submitted, if it contains an unique_id, that id will be used to look up the existing apartment from the database. If the form doesn't contain an unique id, a new database entry will be created using the data entered by the user

django-ajax-selects is built using jQuery Auto开发者_开发百科complete, but the above functionality is quite different from the standard behavior of jQuery Autocomplete and I can't quite figure out how to make the javascript works.

How do I use jQuery Autocomplete to implement this feature? Any help is greatly appreciated. Thanks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜