Answered

How to add form question title or name

  • 27 February 2021
  • 1 reply
  • 1138 views

Hi everyone,

 

I am stuck with an issue. I am saving the form builder answers in my database with the help of onSubmit hanlder.

When I retrieve the form response with Response API it shows the output as following

 

    {
"field": {
"id": "tuK1EK2yiR9D",
"ref": "38d541fa-bc0e-4e32-8d5a-ea60c3cbb349",
"type": "phone_number"
},
"type": "phone_number",
"phone_number": "+91XXXXXX"
},
{
"field": {
"id": "PjaUlRPVyGp7",
"ref": "4fff8e2b-85b5-469d-8144-15ba6b4e73e9",
"type": "email"
},
"type": "email",
"email": "XXXX@gmail.com"
},

 

Actually I need to set the field/question name and title to “field” key  so that I can parse the response and save as per my needs.

But as you see from the above response snapshot the response can’t be figured out which response does it belongs to as there might be many other Phone Number & Email Fields too in my questions, even it might have many multiple choice question.


Is there any way to achieve it with the form builder from admin panel?

icon

Best answer by Nordin 1 March 2021, 16:59

View original

1 reply

Userlevel 5
Badge +3

Hello There, 

Currently, we only pass the Question Reference ID as you could see. We have it already listed as a feature request but I don’t have any ETR that I can share with you, even vaguely. 

You have two workarounds to get around this: 

  1. Add custom description in the Question reference field for each question in their form.
    This can be done manually by modifying the reference fields in the form setting. Like explained in this HC article.
     
  2. If you want to tinker with the results and have access to the backend you can call the Forms API and fetch the question title with some foreach and map. 
    You can follow the example in this video that I recorded. Note that this video is just for guidance and in no way the most efficient way of doing that. I’d recommend you tune that solution to your needs. 

I hope that helps!

Reply