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

EasyAutocomplete doesn't work with goNextPageAutomatic: true #266

Closed
joker-777 opened this issue Jul 26, 2021 · 4 comments
Closed

EasyAutocomplete doesn't work with goNextPageAutomatic: true #266

joker-777 opened this issue Jul 26, 2021 · 4 comments
Assignees
Milestone

Comments

@joker-777
Copy link

Hi, the problem is that you use onSelectItemEvent to select the question value instead of onChooseEvent. This will automatically evaluate the question when hovering over any of the autocomplete options.
https://github.com/surveyjs/custom-widgets/blob/master/src/easy-autocomplete.js#L77

@andrewtelnov
Copy link
Member

@joker-777 That you for reporting and for the tip.

Andrew

@andrewtelnov andrewtelnov added this to the v1.8.59 milestone Jul 31, 2021
@joker-777
Copy link
Author

@andrewtelnov Thanks for fixing this so quickly. I found another problem that was much more complicated. Using goNextPageAutomatic: true, a text input field will evaluate automatically onBlur event which also happens when you click on one of the easyAutocomplete options. This means it automatically uses the text you typed in instead of the option you clicked on.
My workaround, for now, is to overwrite question.correctValueType but I hope there is/will be a more elegant solution.

question.correctValueType = () => {
  if ($el.getSelectedItemData() < 0) return
  return $el.getSelectedItemData()
}   

@andrewtelnov
Copy link
Member

andrewtelnov commented Aug 2, 2021

@joker-777 I believe it makes sense just to remove goNextPageAutomatic functionality support from this widget. Easy complete fires onBlue before selecting the value from the list and we have to apply the value. We can't use corretValueType, at first it is protected, but it is not the main point. Easy complete allows to enter any text and we will kill this functionality in this case.
Plus, why don't you use dataList property of the text question. It works pretty similar and it works out of the box. Here is the example.

Thank you,
Andrew

@joker-777
Copy link
Author

You are probably right. I also realized that the select2 field is actually a much better fit for my use case.

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

No branches or pull requests

2 participants