I’m using the API to pull responses, and I need to do conditional logic based on what the user chose on a multiple choice question.
I know I can assign a ref to the question, but is there a way to do this per answer? I can get the ID of the choice, but that can change easily.
I get JSON like this:
{"type": "choice",
"field": {
"id": "5IyPfSq7OZNG",
"ref": "my-question-1,
"type": "multiple_choice"
},
"choice": {
"id": "A3uXK14qAEPj",
"label": "<<some label>>"
}
}
I want something like:
{"type": "choice",
"field": {
"id": "5IyPfSq7OZNG",
"ref": "my-question-1,
"type": "multiple_choice"
},
"choice": {
“ref”: “my-choice-a”
"id": "A3uXK14qAEPj",
"label": "<<some label>>"
}
}
Best answer by Lasse
Hi Richard,
Lasse from Typeform Support here.
Thanks for the good question. I’m afraid, that at the moment it is not possible to use custom “refs” for “choices” in multiple choice questions.
This is a feature improvement request, and at the moment I cannot guarantee if or when it will be implemented. However, if it does get implemented we will update this thread accordingly:-)
The ID of the choice should not change, unless you make changes to the choices or the question.
As you already shared in your post you can see both the question title + question ref and the choice ID and Label when you use our Retrieve-responses API, so I hope that you for now can use these to double-check that the answers you compare are the same when you apply your logic and conditions.
Thanks for the good question. I’m afraid, that at the moment it is not possible to use custom “refs” for “choices” in multiple choice questions.
This is a feature improvement request, and at the moment I cannot guarantee if or when it will be implemented. However, if it does get implemented we will update this thread accordingly:-)
The ID of the choice should not change, unless you make changes to the choices or the question.
As you already shared in your post you can see both the question title + question ref and the choice ID and Label when you use our Retrieve-responses API, so I hope that you for now can use these to double-check that the answers you compare are the same when you apply your logic and conditions.
But on the other hand, there doesn’t seem like a way to see these refs within the actual response api.
Similarly, each choice has an ID in the question, but none in the answer choices (in an allow multiple selection), so it adds a level of complexity to figure out what even the ID of the answer choice is.
"answers": [
{
"choice": {
"label": "New York"
},
Am I missing something? Is it impossible to get an actual usable reference of some sort for the answers besides the label?
I’m using custom multi-choice refs, and I can see them when fetching responses via the API, which is great. But they don’t seem to be included in the response webhook payload. Are there plans to include them in that payload as well? At the moment, I think we’ll have to just use the webhook to trigger a REST API call back to typeform in order to get all the refs, which should work but it isn’t ideal.
Hi, I was able to select some multiple choice by their ref codes. Actually the “other” option, as it has no ref it cannot be pre selected. Is there a way to trigger “other” to be preselected?
Hi, @joematune 👋 Thanks for the question, and sorry for the slow response time.
I can see it would be useful for your non-technical team to be able. set these values inside the UI/Form builder, but I’m afraid this is still not possible at this time.
I will make sure to pass this on as a feature request with our Product Team, so they can consider this for future improvements.
It would be really useful to be able to set the `ref` for choices via the UI.
We are using Logic right now to set variables based on user choices, and that works fine for a question with a few options. For questions with a lot of choices, countries for example, it’s a bit tedious.