Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoCompleteSelectWidget does not work with empty input #165

Open
TZanke opened this issue May 17, 2016 · 4 comments
Open

AutoCompleteSelectWidget does not work with empty input #165

TZanke opened this issue May 17, 2016 · 4 comments
Labels

Comments

@TZanke
Copy link
Contributor

TZanke commented May 17, 2016

Hallo,

using a AutoCompleteSelect Widget, i encounter a problem when deleting a selected item.

  1. Open form with field (Charfield, default='', blank=True) and save form without changing anything. The field is empty and stays empty in the database

  2. Select a item with AutoCompleteSelect and save form. The item is now saved to the database.

  3. Try to delete the selection. In my case, the input field shown to the user is empty, but in the send POST data the old item id is not deleted. After saving form, the item is still in database.

How is it possible to delete a item to get an empty field again?

@TZanke
Copy link
Contributor Author

TZanke commented May 17, 2016

Update:

after a click outside the input, the post data is correct. So it looks like only a js trigger does not work as expected. With allow_new there is also no problem.

@mlavin mlavin added the bug label May 17, 2016
@mlavin
Copy link
Owner

mlavin commented May 17, 2016

Yes the hidden input is cleared with the autocomplete plugin detects a change or select even which likely requires the input losing focus.

@TZanke
Copy link
Contributor Author

TZanke commented May 17, 2016

After some research it looks like the change event is the right one for older browsers, new browsers support input to trigger all changes made by the user, for example paste.

Would be nice to have best modern browser support by django selectable.

@mlavin
Copy link
Owner

mlavin commented May 17, 2016

selectable does not directly bind to the input change/select/input. It catches the events propagated from the underlying widget from jQuery UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants