Closed tsv2013 closed 5 years ago
You can also use the choicesByUrl
option to populate choices for uatocomplete options:
{
questions: [
{
name: "autocomplete1",
title: "What is your favorite country?",
type: "text",
choicesByUrl: {
url: "https://restcountries.eu/rest/v1/all",
valueName: "name"
}
},
{
name: "autocomplete2",
title: "What car are you driving?",
type: "text",
choices: [
"None",
"Ford",
"Vauxhall",
"Volkswagen",
"Nissan",
"Audi",
"Mercedes-Benz",
"BMW",
"Peugeot",
"Toyota",
"Citroen"
]
}
]
}
I've fixed the issue but unfortunately it hasn't been included in 1.0.53 update. Could you please tell how urgent is this issue for you?
According to the feature request for autocomplete+dropdown, if you add corresponding scripts to your page, the choices
and choicesByUrl
properties will be available for the text
question in the properties area of SurveyJS Builder. Thus you can add autocomplete options via SurveyJS Builder UI. Here is the sample - https://plnkr.co/edit/ZVVBo8Xor5D6s7EFzbPP?p=preview
https://plnkr.co/edit/QtSjQShGsH01GCNzg0vU?p=preview - I edited the plunkr to add in the example questions you have above. It looks like the autocomplete only works with the question that has choicesByUrl, whereas adding plain choices to the text type question results in the error, items[i].getData is not a function
.
This is not urgent for me, just something I noticed. Ultimately I want to add autocomplete to a property dropdown editor, so I think I do that by adding a custom editor for the property, like in this example - https://surveyjs.io/Examples/Builder/?id=custompropertyeditor -- which also looks like it's not working anymore? I remember seeing it working a few weeks back! Some errors in the console here.
@lady3bean Unfortunately fix had not been included in v1.0.53. I wrote about it above. The fix should be included in v1.0.54. SurveyJS releases every tuesday. In case of urgent issue we can release update on demand.
@lady3bean and also you can clone the repo and build it by yourself as a workaround before release.
https://plnkr.co/edit/QtSjQShGsH01GCNzg0vU?p=preview - I edited the plunkr to add in the example questions you have above. It looks like the autocomplete only works with the question that has choicesByUrl, whereas adding plain choices to the text type question results in the error,
items[i].getData is not a function
.This is not urgent for me, just something I noticed. Ultimately I want to add autocomplete to a property dropdown editor, so I think I do that by adding a custom editor for the property, like in this example - https://surveyjs.io/Examples/Builder/?id=custompropertyeditor -- which also looks like it's not working anymore? I remember seeing it working a few weeks back! Some errors in the console here.
the plunker you created is not working for either of static or url based autocomplete, can someone please guide me on how to get this working on my react project. Thanks
Are you requesting a feature, reporting a bug or ask a question?
Reporting a bug
What is the current behavior?
In the example of using the autocomplete widget here: https://surveyjs.io/Examples/Library/?id=custom-widget-autocomplete&platform=Reactjs, no autocomplete functionality is apparent, and there are some errors in the console. This is the same if looking at it with a different framework option and in the Plunkr example.
In my own use, using the surveyjs-widgets repo in React, I can get other widgets such as the signature pad to work, but autocomplete is not working, though there are no errors.
What is the expected behavior?
Error-free functionality of the autocomplete widget.
Also, another person opened up a feature request for autocomplete on dropdowns - https://github.com/surveyjs/surveyjs/issues/521. Is there a way to combine dropdowns with autocomplete? It seems awkward to do autocomplete with text fields that have choices assigned to them, since you can't add choices to the text type questions in the UI, and can only do so through custom JS. For my purposes, it would be best if users had a dropdown where they could click on choices as well as the ability to do an autocomplete search within the choices, so if there's any way to do that I'd love to know.
How would you reproduce the current behavior (if this is a bug)?
Type in the input box https://surveyjs.io/Examples/Library/?id=custom-widget-autocomplete&platform=Reactjs
Provide the test code and the tested page URL (if applicable)
Tested page URL: https://surveyjs.io/Examples/Library/?id=custom-widget-autocomplete&platform=Reactjs
Test code
Specify your