Question T9803
Visible to All Users

Selection of place of birth : dropdown with an API

created 3 years ago (modified 3 years ago)

Hello !

In one of my questionnaires on Survey Creator V2, I use an API (https://geo.api.gouv.fr/departements/)) to dynamically display the departments and their cities.

Here is my current setting:

Clipboard-File-3.png

What I would like to do is display the number of the department (code) and his name (nom), not just the name as currently (for exemple : 02 - Aisne). Is it possible to add several elements to the display texts ?

Regards,

Antony.

Answers approved by surveyjs Support

created 3 years ago

Hello,

You can use the https://surveyjs.io/Documentation/Library?id=surveymodel#onLoadChoicesFromServer event to change item texts before they will be assigned to a question.
Here is the example of how it works - https://plnkr.co/edit/zUTkNh6uxWww1G7R?preview

Thanks, Serge
SurveyJS Team