A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/apps-script/reference/forms/choice below:

Class Choice | Apps Script

Class Choice

Stay organized with collections Save and categorize content based on your preferences.

Choice

A single choice associated with a type of Item that supports choices, like CheckboxItem, ListItem, or MultipleChoiceItem.

// Create a new form and add a multiple-choice item.
const form = FormApp.create('Form Name');
const item = form.addMultipleChoiceItem();
item.setTitle('Do you prefer cats or dogs?').setChoices([
  item.createChoice('Cats', FormApp.PageNavigationType.CONTINUE),
  item.createChoice('Dogs', FormApp.PageNavigationType.RESTART),
]);

// Add another page because navigation has no effect on the last page.
form.addPageBreakItem().setTitle('You chose well!');

// Log the navigation types that each choice results in.
const choices = item.getChoices();
for (let i = 0; i < choices.length; i++) {
  Logger.log(
      'If the respondent chooses "%s", the form will %s.',
      choices[i].getValue(),
      choices[i].getPageNavigationType(),
  );
}
Detailed documentation getGotoPage()

Gets the PageBreakItem set as a GO_TO_PAGE destination if the responder selects this choice and completes the current page. This method applies only to choices associated with MultipleChoiceItems; for other choices, it returns null.

Return

PageBreakItem — the GO_TO_PAGE destination for this choice, or null if there is none

Scripts that use this method require authorization with one or more of the following scopes:

getPageNavigationType()

Gets the PageNavigationType that occurs if the responder selects this choice and completes the current page. This method applies only to choices associated with MultipleChoiceItems; for other choices, it returns null.

Return

PageNavigationType — the navigation action for this choice, or null if there is none

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

getValue()

Gets the choice's value, which respondents see as a label when viewing the form.

Return

String — the choice's value

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

isCorrectAnswer()

Gets whether the choice is a correct answer for the question. This method only applies to questions that are part of a quiz; for non-quiz forms, it returns false.

Return

Boolean — Whether the choice is a correct answer.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-12-02 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-02 UTC."],[[["A Choice object represents a single selection option within Google Forms items like checkboxes, lists, and multiple-choice questions."],["Choices can be associated with specific navigation actions, like continuing to the next page or restarting the form, using `PageNavigationType`."],["You can retrieve a choice's display value (what the user sees) and determine if it's marked as a correct answer (for quizzes) using dedicated methods."],["Choice objects are integral for defining response options and controlling form flow based on user selections."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4