I have a google form where I have a multiple choice question "Territory field". This field is having two valid answer
- United States and
- Others (When you choose other option you can write down any Country name in text area) Now I am trying to submit this form using google app script. While submitting from app script if I am sending answer to this multiple choice question as "United States" its workiing. I want to send Others as answer to this question while submitting the form. Can anyone help me out. I am including picture of field and script below for reference .
Picture of form field with multiple choice
I am trying to submit this form using google script (part of script mentioned below).
var formID = "xxxxxxxxxxxxxxxxxxxxxx";
var Formobj= FormApp.openById(formID);
var formResponse = Formobj.createResponse();
var items = Formobj.getItems();
var territory = items[1]
var territoryvalue = "United States"
if (territoryvalue.indexOf("United States") !== -1)
{
var territoryfield = territory.asMultipleChoiceItem()
var territoryresponse = territoryfield .createResponse([["United States"]])
formResponse.withItemResponse(territoryresponse);
}
Field value after form is submitted with United states as answer
Need help in submitting this form with "Others" as answer
I saw you filed a bug in Issue Tracker, and based on your explanation there I could finally understand this issue.
This seems to be a bug:
In Forms, if a Multiple choice item gets submitted with an
Other
choice via Apps Script, this other choice is not populated when trying to edit the response. If the response is submitted via UI, theOther
option is populated.It's important to note that the response itself is getting submitted successfully, and can be seen in the
Responses
tab of the Form; it's just not populated when trying to edit the response.Steps to reproduce:
Multiple choice item
for the Form, if there is not one already.add "Other"
in order to have anOther option
.Settings
(gear icon) and check the option Respondents can: Edit after submit.editUrl
) with the browser.Option 2
should be populated when trying to edit the response, but it's not.Issue Tracker:
The issue you filed in Issue Tracker just got forwarded internally by Google:
Anyone affected by this, please consider clicking the star on the top-left in order to keep track of it and to help prioritizing it.