Class Choice
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
পছন্দ Checkbox Item
, List Item
, বা Multiple Choice Item
মতো পছন্দগুলিকে সমর্থন করে এমন একটি Item
সাথে যুক্ত একটি একক পছন্দ৷
// 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(),
);
}
বিস্তারিত ডকুমেন্টেশন
get Goto Page()
Page Break Item
একটি GO_TO_PAGE
গন্তব্য হিসাবে সেট করে যদি উত্তরদাতা এই পছন্দটি নির্বাচন করে এবং বর্তমান পৃষ্ঠাটি সম্পূর্ণ করে। এই পদ্ধতিটি শুধুমাত্র Multiple Choice Items
সাথে যুক্ত পছন্দের ক্ষেত্রে প্রযোজ্য; অন্যান্য পছন্দের জন্য, এটি null
প্রদান করে।
প্রত্যাবর্তন
Page Break Item
— এই পছন্দের জন্য GO_TO_PAGE
গন্তব্য, অথবা যদি কোনটি না থাকে তাহলে null
অনুমোদন
যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
get Page Navigation Type()
Page Navigation Type
পায় যেটি ঘটে যদি উত্তরদাতা এই পছন্দটি নির্বাচন করে এবং বর্তমান পৃষ্ঠাটি সম্পূর্ণ করে। এই পদ্ধতিটি শুধুমাত্র Multiple Choice Items
সাথে যুক্ত পছন্দের ক্ষেত্রে প্রযোজ্য; অন্যান্য পছন্দের জন্য, এটি null
প্রদান করে।
প্রত্যাবর্তন
Page Navigation Type
— এই পছন্দের জন্য নেভিগেশন অ্যাকশন, অথবা কোনোটি না থাকলে null
অনুমোদন
যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
get Value()
পছন্দের মান পায়, যা উত্তরদাতারা ফর্মটি দেখার সময় একটি লেবেল হিসাবে দেখে।
প্রত্যাবর্তন
String
- পছন্দের মান
অনুমোদন
যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
is Correct Answer()
পছন্দটি প্রশ্নের সঠিক উত্তর কিনা তা পায়। এই পদ্ধতিটি শুধুমাত্র প্রশ্নগুলির ক্ষেত্রে প্রযোজ্য যা একটি কুইজের অংশ; নন-ক্যুইজ ফর্মের জন্য, এটি মিথ্যা ফেরত দেয়।
প্রত্যাবর্তন
Boolean
— পছন্দটি সঠিক উত্তর কিনা।
অনুমোদন
যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-07-25 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-07-25 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eA Choice object represents a single selection option within Google Forms items like checkboxes, lists, and multiple-choice questions.\u003c/p\u003e\n"],["\u003cp\u003eChoices can be associated with specific navigation actions, like continuing to the next page or restarting the form, using \u003ccode\u003ePageNavigationType\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou 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.\u003c/p\u003e\n"],["\u003cp\u003eChoice objects are integral for defining response options and controlling form flow based on user selections.\u003c/p\u003e\n"]]],[],null,["# Class Choice\n\nChoice\n\nA single choice associated with a type of [Item](/apps-script/reference/forms/item) that supports choices, like [CheckboxItem](/apps-script/reference/forms/checkbox-item), [ListItem](/apps-script/reference/forms/list-item), or [MultipleChoiceItem](/apps-script/reference/forms/multiple-choice-item).\n\n```javascript\n// Create a new form and add a multiple-choice item.\nconst form = FormApp.create('Form Name');\nconst item = form.addMultipleChoiceItem();\nitem.setTitle('Do you prefer cats or dogs?').setChoices([\n item.createChoice('Cats', FormApp.PageNavigationType.CONTINUE),\n item.createChoice('Dogs', FormApp.PageNavigationType.RESTART),\n]);\n\n// Add another page because navigation has no effect on the last page.\nform.addPageBreakItem().setTitle('You chose well!');\n\n// Log the navigation types that each choice results in.\nconst choices = item.getChoices();\nfor (let i = 0; i \u003c choices.length; i++) {\n Logger.log(\n 'If the respondent chooses \"%s\", the form will %s.',\n choices[i].getValue(),\n choices[i].getPageNavigationType(),\n );\n}\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------------------------|-------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [getGotoPage()](#getGotoPage()) | [PageBreakItem](/apps-script/reference/forms/page-break-item) | Gets the [PageBreakItem](/apps-script/reference/forms/page-break-item) set as a [GO_TO_PAGE](/apps-script/reference/forms/page-navigation-type) destination if the responder selects this choice and completes the current page. |\n| [getPageNavigationType()](#getPageNavigationType()) | [PageNavigationType](/apps-script/reference/forms/page-navigation-type) | Gets the [PageNavigationType](/apps-script/reference/forms/page-navigation-type) that occurs if the responder selects this choice and completes the current page. |\n| [getValue()](#getValue()) | `String` | Gets the choice's value, which respondents see as a label when viewing the form. |\n| [isCorrectAnswer()](#isCorrectAnswer()) | `Boolean` | Gets whether the choice is a correct answer for the question. |\n\nDetailed documentation\n----------------------\n\n### `get``Goto``Page()`\n\nGets the [PageBreakItem](/apps-script/reference/forms/page-break-item) set as a [GO_TO_PAGE](/apps-script/reference/forms/page-navigation-type) destination\nif the responder selects this choice and completes the current page. This method applies only\nto choices associated with [MultipleChoiceItems](/apps-script/reference/forms/multiple-choice-item); for other choices,\nit returns `null`.\n\n#### Return\n\n\n[PageBreakItem](/apps-script/reference/forms/page-break-item) --- the [GO_TO_PAGE](/apps-script/reference/forms/page-navigation-type) destination for this choice, or `null` if there is none\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/forms.currentonly`\n- `https://www.googleapis.com/auth/forms`\n\n*** ** * ** ***\n\n### `get``Page``Navigation``Type()`\n\nGets the [PageNavigationType](/apps-script/reference/forms/page-navigation-type) that occurs if the responder selects this choice and\ncompletes the current page. This method applies only to choices associated with [MultipleChoiceItems](/apps-script/reference/forms/multiple-choice-item); for other choices, it returns `null`.\n\n#### Return\n\n\n[PageNavigationType](/apps-script/reference/forms/page-navigation-type) --- the navigation action for this choice, or `null` if there is none\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/forms.currentonly`\n- `https://www.googleapis.com/auth/forms`\n\n*** ** * ** ***\n\n### `get``Value()`\n\nGets the choice's value, which respondents see as a label when viewing the form.\n\n#### Return\n\n\n`String` --- the choice's value\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/forms.currentonly`\n- `https://www.googleapis.com/auth/forms`\n\n*** ** * ** ***\n\n### `is``Correct``Answer()`\n\nGets whether the choice is a correct answer for the question. This method only applies to\nquestions that are part of a quiz; for non-quiz forms, it returns false.\n\n#### Return\n\n\n`Boolean` --- Whether the choice is a correct answer.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/forms.currentonly`\n- `https://www.googleapis.com/auth/forms`"]]