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
Autocomplete field does not work with on('change', $form->js->form(submit)) - triggers twice #321
Comments
Couple of things happen here.
Even returning a notifier, form will be submit many time with the way the basic AutoComplete is define. Every time a user will use the up or down arrow key on their keyboard, it will fire the submit event. Plus, the submit event will also fire on blur event, i.e. when getting away from the field. AutoComplete is based on semantic-ui Dropdown module. For better control on the 'change' event, I would redefine the semantic-ui Dropdown module options and adjust accordingly to your need by setting the onChange handler. Here is how to:
|
Hi Ibelar, A quick idea, but I am no JS expert... could this work? Just add all this JS in AutoComplete->init(), only for each individual Autocomplete/all Autocompletes? Best regards |
Sure can. You can extends AutoComplete and pass your own options in init() method:
|
@ibelar maybe we should move $chain->dropdown into a separate method, so that users could override that if they wanted to? |
Good idea. let me check on that. |
Hi ibelar, did you test the last code you posted? I tried it, but for me it does not work. Adding the JS you posted in #321 (comment) works perfectly on the contrary. |
Philipp; Code has change since the last time. You can now pass the dropdown setting directly
Something like above should work, passing the settings array to Addfield. Or look at the new Autocomplete::initDropdown($chain) method to achieve what you need. hope this help; |
Hi, this works perfect, tanks for all the JS help! Best reagards |
What's the outcome of this ticket? invalid? not really a bug? Needs enhancement somewhere? |
IMO its a bug, but caused by Semantic-UI JS as far as I understand. The last fix Ibelar posted works perfectly in terms of functionality. Im terms of coding, creating the onChange event differs:
To keep ATK UI coding style consistent, creating this functionality via $autocomplete->on('change'..... Best regards |
we can technically override on() method............. |
read into Semantic UI a bit yesterday, there was hardly any development for over a year but its starting to roll again. Perhaps it will be fixed this way? I didn't try to find a corresponding issue in Sematic UI as there is over 1000 open issues... |
:) yeah, if it's not a big trouble, send Jack a donation, i'm doing that monthly and I think it's great encouragement. Our project relies on Semantic UI heavily so we need them to keep going. Button is at the bottom of the semantic-ui.com page. |
lets check in hangout if this issue can be closed, there were many changes introduced in Fomantic-UI to DropDown. |
AutoComplete::onChange and DropDown::onChange is now working. Closing this. |
If the Autocomplete field is used with on change event listener to submit the form, the form gets submitted twice if the search field is used. See this screencast:
see: http://www.spame.de/autocompletebug.mkv
The code for this is:
Best regards
Philipp
The text was updated successfully, but these errors were encountered: