نموذج يحتوي على خصائص وعناصر عامة تتضمن الخصائص العنوان والإعدادات ومكان تخزين الردود. تتضمن العناصر عناصر الأسئلة، مثل مربّعات الاختيار أو عناصر الراديو، في حين تشير عناصر التنسيق إلى عناصر مثل فواصل الصفحات. يمكن الوصول إلى "نماذج Google" أو إنشاؤها من FormApp
.
// Open a form by ID and create a new spreadsheet. var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); var ss = SpreadsheetApp.create('Spreadsheet Name'); // Update form properties via chaining. form.setTitle('Form Name') .setDescription('Description of form') .setConfirmationMessage('Thanks for responding!') .setAllowResponseEdits(true) .setAcceptingResponses(false); // Update the form's response destination. form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());
الطُرق
الطريقة | نوع الإرجاع | وصف قصير |
---|---|---|
addCheckboxGridItem() | CheckboxGridItem | تُرفِق عنصر سؤال جديدًا معروضًا كشبكة من الأعمدة والصفوف، ما يسمح للمجيب باختيار عدة خيارات لكل صف من سلسلة من مربّعات الاختيار. |
addCheckboxItem() | CheckboxItem | تُرفِق عنصر سؤالاً جديدًا يسمح للمجيب باختيار مربّع اختيار واحد أو أكثر، بالإضافة إلى حقل "غير ذلك" اختياري. |
addDateItem() | DateItem | تُرفِق عنصر سؤال جديد يسمح للمجيب بأن يشير إلى تاريخ. |
addDateTimeItem() | DateTimeItem | لإلحاق عنصر سؤال جديد يسمح للمجيب بأن يشير إلى تاريخ ووقت. |
addDurationItem() | DurationItem | تُرفِق عنصر سؤالاً جديدًا يسمح للمجيب بأن يشير إلى طول المدة الزمنية. |
addEditor(emailAddress) | Form | لإضافة المستخدم المحدد إلى قائمة محرري Form . |
addEditor(user) | Form | لإضافة المستخدم المحدد إلى قائمة محرري Form . |
addEditors(emailAddresses) | Form | لإضافة مصفوفة محددة من المستخدمين إلى قائمة المحرِّرين في Form . |
addGridItem() | GridItem | تُرفِق عنصر سؤال جديدًا معروضًا كشبكة من الأعمدة والصفوف، ما يسمح للمجيب باختيار خيار واحد في كل صف من سلسلة من أزرار الاختيار. |
addImageItem() | ImageItem | تُلحِق عنصر تنسيق جديدًا يعرض صورة. |
addListItem() | ListItem | لإلحاق عنصر سؤال جديد يتيح للمجيب اختيار خيار واحد من القائمة المنسدلة. |
addMultipleChoiceItem() | MultipleChoiceItem | لإضافة عنصر سؤال جديد يسمح للمجيب بأن يُحدِّد خيارًا واحدًا من قائمة أزرار الاختيار أو حقل "غير ذلك" اختياري. |
addPageBreakItem() | PageBreakItem | لإضافة عنصر تنسيق جديد يحدّد بداية صفحة معيّنة. |
addParagraphTextItem() | ParagraphTextItem | لإضافة عنصر سؤال جديد يسمح للمجيب بإدخال مجموعة من النصوص. |
addScaleItem() | ScaleItem | تُرفِق عنصر سؤال جديد يسمح للمجيب بأن يُحدِّد خيارًا واحدًا من تسلسل أزرار الاختيار. |
addSectionHeaderItem() | SectionHeaderItem | لإلحاق عنصر تنسيق جديد يشير بشكل مرئي إلى بداية قسم. |
addTextItem() | TextItem | لإلحاق عنصر سؤال جديد يسمح للمجيب بإدخال سطر واحد من النص. |
addTimeItem() | TimeItem | تُرفِق عنصر سؤال جديد يسمح للمجيب بأن يشير إلى وقت من اليوم. |
addVideoItem() | VideoItem | تُلحِق عنصر تنسيق جديد يعرض فيديو. |
canEditResponse() | Boolean | تحدد ما إذا كان النموذج يعرض رابطًا لتعديل الرد بعد إرساله. |
collectsEmail() | Boolean | ويحدِّد ما إذا كان النموذج يجمع عناوين البريد الإلكتروني للمجيبين. |
createResponse() | FormResponse | إنشاء ردّ جديد على النموذج |
deleteAllResponses() | Form | حذف جميع الردود المُرسَلة من مخزن الردود على النموذج. |
deleteItem(index) | void | حذف العنصر في فهرس معين بين جميع العناصر في النموذج |
deleteItem(item) | void | حذف العنصر المحدد |
deleteResponse(responseId) | Form | حذف رد واحد من مخزن ردود النموذج. |
getConfirmationMessage() | String | الحصول على رسالة تأكيد النموذج |
getCustomClosedFormMessage() | String | يحصل على الرسالة المخصصة التي يتم عرضها إذا كان النموذج لا يقبل الاستجابات أو سلسلة فارغة إذا لم يتم ضبط رسالة مخصصة. |
getDescription() | String | الحصول على وصف النموذج. |
getDestinationId() | String | الحصول على رقم تعريف وجهة الرد على النموذج |
getDestinationType() | DestinationType | الحصول على نوع وجهة الرد على النموذج |
getEditUrl() | String | يحصل على عنوان URL الذي يمكن استخدامه للوصول إلى وضع التعديل في النموذج. |
getEditors() | User[] | الحصول على قائمة المحرِّرين لـ Form |
getId() | String | الحصول على رقم تعريف النموذج |
getItemById(id) | Item | الحصول على العنصر باستخدام معرّف معيّن |
getItems() | Item[] | للحصول على صفيف من كل العناصر في النموذج. |
getItems(itemType) | Item[] | للحصول على مصفوفة من جميع العناصر من نوع معيّن. |
getPublishedUrl() | String | الحصول على عنوان URL الذي يمكن استخدامه للردّ على النموذج |
getResponse(responseId) | FormResponse | يحصل على رد نموذج واحد استنادًا إلى رقم تعريف الاستجابة. |
getResponses() | FormResponse[] | الحصول على مجموعة من جميع ردود النموذج |
getResponses(timestamp) | FormResponse[] | يحصل على صفيف من جميع ردود النموذج بعد تاريخ ووقت معيّنَين. |
getShuffleQuestions() | Boolean | وتحدّد هذه السياسة ما إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا. |
getSummaryUrl() | String | الحصول على عنوان URL الذي يمكن استخدامه لعرض ملخّص لردود النموذج |
getTitle() | String | الحصول على عنوان النموذج |
hasLimitOneResponsePerUser() | Boolean | يحدد هذا الإعداد ما إذا كان النموذج يسمح برد واحد فقط لكل مجيب. |
hasProgressBar() | Boolean | تحدِّد هذه السياسة ما إذا كان النموذج يعرض شريط تقدّم. |
hasRespondAgainLink() | Boolean | تحدد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد إكمال النموذج. |
isAcceptingResponses() | Boolean | ويحدّد ما إذا كان النموذج يقبل الردود حاليًا. |
isPublishingSummary() | Boolean | تحدّد هذه السياسة ما إذا كان النموذج يعرض رابطًا لعرض ملخّص الردود بعد إكمال النموذج. |
isQuiz() | Boolean | تُحدِّد هذه السمة ما إذا كان النموذج عبارة عن اختبار. |
moveItem(from, to) | Item | لنقل عنصر في فهرس معين بين جميع العناصر في النموذج إلى فهرس آخر. |
moveItem(item, toIndex) | Item | نقل عنصر معيّن إلى فهرس معيّن بين جميع العناصر في النموذج |
removeDestination() | Form | يؤدي هذا الخيار إلى إلغاء ربط النموذج بوجهة الاستجابة الحالية. |
removeEditor(emailAddress) | Form | يزيل المستخدم المحدد من قائمة أدوات تحرير Form . |
removeEditor(user) | Form | يزيل المستخدم المحدد من قائمة أدوات تحرير Form . |
requiresLogin() | Boolean | ويحدّد ما إذا كان النموذج يتطلب من المشاركين تسجيل الدخول إلى حساب في النطاق نفسه أو نطاق فرعي قبل الرد. |
setAcceptingResponses(enabled) | Form | يحدّد ما إذا كان النموذج يقبل الردود حاليًا. |
setAllowResponseEdits(enabled) | Form | لضبط ما إذا كان النموذج يعرض رابطًا لتعديل الرد بعد إرساله. |
setCollectEmail(collect) | Form | لضبط ما إذا كان النموذج يجمع عناوين البريد الإلكتروني للمجيبين. |
setConfirmationMessage(message) | Form | إعداد رسالة التأكيد للنموذج |
setCustomClosedFormMessage(message) | Form | لضبط الرسالة لعرضها في حال عدم قبول النموذج للردود |
setDescription(description) | Form | لضبط وصف النموذج. |
setDestination(type, id) | Form | لضبط الوجهة التي يتم فيها حفظ الردود على النموذج. |
setIsQuiz(enabled) | Form | تحدد ما إذا كان النموذج اختبارًا. |
setLimitOneResponsePerUser(enabled) | Form | لضبط ما إذا كان النموذج يسمح برد واحد فقط لكل مجيب. |
setProgressBar(enabled) | Form | إعداد ما إذا كان النموذج يحتوي على شريط التقدم |
setPublishingSummary(enabled) | Form | يتم تحديد ما إذا كان النموذج يعرض رابطًا لعرض ملخّص الردود بعد أن يرسل المُجيب النموذج. |
setRequireLogin(requireLogin) | Form | لضبط ما إذا كان النموذج يتطلب من المشاركين تسجيل الدخول إلى حساب في النطاق نفسه أو نطاق فرعي قبل الرد. |
setShowLinkToRespondAgain(enabled) | Form | لضبط ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد إكمال النموذج. |
setShuffleQuestions(shuffle) | Form | لتحديد ما إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا. |
setTitle(title) | Form | ضبط عنوان النموذج |
shortenFormUrl(url) | String | لتحويل عنوان URL طويل لنموذج إلى عنوان URL قصير. |
submitGrades(responses) | Form | إرسال الدرجات لـ FormResponses المحددة. |
المستندات التفصيلية
addCheckboxGridItem()
تُرفِق عنصر سؤال جديدًا معروضًا كشبكة من الأعمدة والصفوف، ما يسمح للمجيب باختيار عدة خيارات لكل صف من سلسلة من مربّعات الاختيار.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds a checkbox grid item. const item = form.addCheckboxGridItem(); // Sets the title 'Where did you celebrate New Year's?' item.setTitle('Where did you celebrate New Year's?'); // Sets the grid's rows and columns. item.setRows(['New York', 'San Francisco', 'London']) .setColumns(['2014', '2015', '2016', '2017']);
رحلة العودة
CheckboxGridItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addCheckboxItem()
تُرفِق عنصر سؤالاً جديدًا يسمح للمجيب باختيار مربّع اختيار واحد أو أكثر، بالإضافة إلى حقل "غير ذلك" اختياري.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds a checkbox item. const item = form.addCheckboxItem(); // Sets the title of the checkbox item to 'Do you prefer cats or dogs?' item.setTitle('Do you prefer cats or dogs?'); // Sets the choices. item.setChoiceValues(['Cats', 'Dogs']);
رحلة العودة
CheckboxItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addDateItem()
تُرفِق عنصر سؤال جديد يسمح للمجيب بأن يشير إلى تاريخ.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds a date item. const item = form.addDateItem(); // Sets the title to 'When were you born?' item.setTitle('When were you born?'); // Sets the description for the date item. item.setHelpText('Some helper text.');
رحلة العودة
DateItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addDateTimeItem()
لإلحاق عنصر سؤال جديد يسمح للمجيب بأن يشير إلى تاريخ ووقت.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds a question with date and time inputs. const item = form.addDateTimeItem(); // Sets the title to 'When were you born?' item.setTitle('When were you born?'); // Sets the question as required. item.setRequired(true);
رحلة العودة
DateTimeItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addDurationItem()
تُرفِق عنصر سؤالاً جديدًا يسمح للمجيب بأن يشير إلى طول المدة الزمنية.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds a question with a duration input. const item = form.addDurationItem(); // Sets the title to 'How long can you hold your breath?' item.setTitle('How long can you hold your breath?'); // Sets the question as required. item.setRequired(true);
رحلة العودة
DurationItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addEditor(emailAddress)
لإضافة المستخدم المحدد إلى قائمة محرري Form
. إذا كان المستخدم مدرجًا
في قائمة المشاهدين، ستنقل هذه الطريقة المستخدم إلى قائمة المشاهدين.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
emailAddress | String | عنوان البريد الإلكتروني للمستخدم الذي تريد إضافته. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addEditor(user)
لإضافة المستخدم المحدد إلى قائمة محرري Form
. إذا كان المستخدم مدرجًا
في قائمة المشاهدين، ستنقل هذه الطريقة المستخدم إلى قائمة المشاهدين.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
user | User | تمثيل المستخدم المراد إضافته. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addEditors(emailAddresses)
لإضافة مصفوفة محددة من المستخدمين إلى قائمة المحرِّرين في Form
. وإذا كان أيٌّ من المستخدمين
مُدرَجًا في قائمة المشاهدين، ستنقلهم هذه الطريقة خارج قائمة
المشاهدين.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
emailAddresses | String[] | مصفوفة من عناوين البريد الإلكتروني للمستخدمين المطلوب إضافتها. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addGridItem()
تُرفِق عنصر سؤال جديدًا معروضًا كشبكة من الأعمدة والصفوف، ما يسمح للمجيب باختيار خيار واحد في كل صف من سلسلة من أزرار الاختيار.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds a multiple choice grid. const item = form.addGridItem(); // Sets the title to 'Rate your interests.' item.setTitle('Rate your interests'); // Sets the grid's rows and columns. item.setRows(['Cars', 'Computers', 'Celebrities']) .setColumns(['Boring', 'So-so', 'Interesting']);
رحلة العودة
GridItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addImageItem()
تُلحِق عنصر تنسيق جديدًا يعرض صورة.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds an image item. const item = form.addImageItem(); // Gets the Google icon to use as the image. const img = UrlFetchApp.fetch('https://fonts.gstatic.com/s/i/productlogos/googleg/v6/web-24dp/logo_googleg_color_1x_web_24dp.png'); // Sets the image, title, and description for the item. item.setTitle('Google icon').setHelpText('Google icon').setImage(img);
رحلة العودة
ImageItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addListItem()
لإلحاق عنصر سؤال جديد يتيح للمجيب اختيار خيار واحد من القائمة المنسدلة.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds a dropdown list to the form. const item = form.addListItem(); // Sets the title to 'Do you prefer cats or dogs?' item.setTitle('Do you prefer cats or dogs?'); // Sets the description to 'This is description text...' item.setHelpText('This is description text...'); // Creates and adds choices to the dropdown list. item.setChoices([ item.createChoice('dog'), item.createChoice('cat') ]);
رحلة العودة
ListItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addMultipleChoiceItem()
لإضافة عنصر سؤال جديد يسمح للمجيب بأن يُحدِّد خيارًا واحدًا من قائمة أزرار الاختيار أو حقل "غير ذلك" اختياري.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds a multiple choice item to the form. const item = form.addMultipleChoiceItem(); // Sets the title. item.setTitle('What is your favorite ice cream flavor?'); // Creates some choice items. const vanilla = item.createChoice('vanilla'); const chocolate = item.createChoice('chocolate'); const strawberry = item.createChoice('strawberry'); // Sets the choices. item.setChoices([vanilla, chocolate, strawberry]);
رحلة العودة
MultipleChoiceItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addPageBreakItem()
لإضافة عنصر تنسيق جديد يحدّد بداية صفحة معيّنة.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds page break items to create a second and third page for the form. const pageTwo = form.addPageBreakItem(); const pageThree = form.addPageBreakItem(); // Sets the titles for the pages. pageTwo.setTitle('Page two'); pageThree.setTitle('Page three'); // Upon completion of the first page, sets the form to navigate to the third page. pageTwo.setGoToPage(pageThree); // Upon completion of the second page, sets the form to navigate back to the first page. pageThree.setGoToPage(FormApp.PageNavigationType.RESTART);
رحلة العودة
PageBreakItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addParagraphTextItem()
لإضافة عنصر سؤال جديد يسمح للمجيب بإدخال مجموعة من النصوص.
// Opens the form by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds the paragraph text item. const item = form.addParagraphTextItem(); // Sets the title to 'What is your address?' item.setTitle('What is your address?');
رحلة العودة
ParagraphTextItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addScaleItem()
تُرفِق عنصر سؤال جديد يسمح للمجيب بأن يُحدِّد خيارًا واحدًا من تسلسل أزرار الاختيار.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds the scale item. const item = form.addScaleItem(); // Sets the title of the scale item to 'Choose a number.' item.setTitle('Choose a number'); // Sets the scale to 1-5. item.setBounds(1, 5); // Sets the label for the lower and upper bounds. item.setLabels('Lowest', 'Highest');
رحلة العودة
ScaleItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addSectionHeaderItem()
لإلحاق عنصر تنسيق جديد يشير بشكل مرئي إلى بداية قسم.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds the section heading item. const item = form.addSectionHeaderItem(); // Sets the title to 'Title of new section.' item.setTitle('Title of new section'); // Sets the description. item.setHelpText('Description of new section');
رحلة العودة
SectionHeaderItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addTextItem()
لإلحاق عنصر سؤال جديد يسمح للمجيب بإدخال سطر واحد من النص.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds a single-line text item. const item = form.addTextItem(); // Sets the title to 'What is your name?' item.setTitle('What is your name?');
رحلة العودة
TextItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addTimeItem()
تُرفِق عنصر سؤال جديد يسمح للمجيب بأن يشير إلى وقت من اليوم.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds a question with a time input. const item = form.addTimeItem(); // Sets the title to 'What time do you usually wake up in the morning?' item.setTitle('What time do you usually wake up in the morning?');
رحلة العودة
TimeItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
addVideoItem()
تُلحِق عنصر تنسيق جديد يعرض فيديو.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Adds a video item. const item = form.addVideoItem(); // Sets the title, description, and video. item.setTitle('YouTube video') .setHelpText('Send content automatically via Google Sheets and Apps Script') .setVideoUrl('https://youtu.be/xxgQr-jSu9o'); // Sets the alignment to the center. item.setAlignment(FormApp.Alignment.CENTER);
رحلة العودة
VideoItem
— العنصر الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
canEditResponse()
تحدد ما إذا كان النموذج يعرض رابطًا لتعديل الرد بعد إرساله.
بغض النظر عن هذا الإعداد، تسمح الطريقة FormResponse.getEditResponseUrl()
لمؤلف النص البرمجي الذي لديه إذن الوصول للتعديل إلى النموذج بإنشاء عنوان URL يمكن استخدامه لتعديل استجابة.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Checks if the form displays a link to edit a response after submitting it. // The default is false. To let people edit their responses, use // form.setAllowResponseEdits(true). const edit = form.canEditResponse(); // If the form doesn't let people edit responses, logs false to the console. console.log(edit);
رحلة العودة
Boolean
- true
إذا كان النموذج يعرض رابط "تعديل ردّك"، false
إذا لم يكن كذلك.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
collectsEmail()
ويحدِّد ما إذا كان النموذج يجمع عناوين البريد الإلكتروني للمجيبين.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets the form to not collect respondents' email addresses. form.setCollectEmail(false); // Checks whether the form collects respondents' email addresses and logs it to the console. const bool = form.collectsEmail(); console.log(bool);
رحلة العودة
Boolean
- true
إذا كان النموذج يجمع عناوين البريد الإلكتروني، false
إذا لم ينفِّذ ذلك.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
createResponse()
إنشاء ردّ جديد على النموذج للإجابة عن عنصر سؤال، عليك إنشاء ItemResponse
من العنصر، ثم إرفاقه بهذا الردّ على النموذج من خلال الاتصال بـ FormResponse.withItemResponse(response)
. لحفظ الرد المجمّع، اطلب FormResponse.submit()
.
رحلة العودة
FormResponse
: ردّ النموذج الذي تم إنشاؤه حديثًا
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
deleteAllResponses()
حذف جميع الردود المُرسَلة من مخزن الردود على النموذج. لا تحذف هذه الطريقة نُسخًا من الردود المخزنة في وجهة استجابة خارجية (مثل جدول بيانات)، ولكنها تمحو طريقة عرض ملخص النموذج.
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
deleteItem(index)
حذف العنصر في فهرس معين بين جميع العناصر في النموذج طرح استثناء للنص البرمجي في حال عدم توفّر عنصر في الفهرس المحدّد
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets all the items from the form. const items = form.getItems(); // Finds the index of a paragraph text item and deletes it by the item's index. const index = items.findIndex(item => item.getType() === FormApp.ItemType.PARAGRAPH_TEXT); if (index !== -1) { form.deleteItem(index); }
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
index | Integer | فهرس العنصر بين جميع العناصر في النموذج. |
رمي
Error
: في حال عدم توفّر أي عنصر في الفهرس المحدّد
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
deleteItem(item)
حذف العنصر المحدد توفير استثناء للنص البرمجي إذا تم حذف العنصر من قبل
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets all of the items from the form. const items = form.getItems(); // Finds a paragraph text item and deletes it. const item = items.find(item => item.getType() === FormApp.ItemType.PARAGRAPH_TEXT); if (item) { form.deleteItem(item); }
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
item | Item | العنصر المطلوب حذفه |
رمي
Error
: في حال عدم توفّر العنصر في النموذج
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
deleteResponse(responseId)
حذف رد واحد من مخزن ردود النموذج. لا تؤدي هذه الطريقة إلى حذف نُسخ من الردود المحفوظة في وجهة استجابة خارجية (مثل جدول البيانات)، ولكنها تزيل الرد من العرض الملخّص للنموذج. يمكن استرداد رقم تعريف الاستجابة باستخدام FormResponse.getId()
.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
responseId | String | رقم تعريف الرد على النموذج المطلوب حذفه |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getConfirmationMessage()
الحصول على رسالة تأكيد النموذج
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets the confirmation message to display after someone submits the form. form.setConfirmationMessage('You successfully submitted the form.'); // Gets the confirmation message and logs it to the console. const message = form.getConfirmationMessage(); console.log(message);
رحلة العودة
String
- رسالة تأكيد النموذج.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getCustomClosedFormMessage()
يحصل على الرسالة المخصصة التي يتم عرضها إذا كان النموذج لا يقبل الاستجابات أو سلسلة فارغة إذا لم يتم ضبط رسالة مخصصة.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets a custom closed form message to display to the user when the form // no longer accepts responses. form.setCustomClosedFormMessage('The form is no longer accepting responses.'); // Gets the custom message set for the form and logs it to the console. const message = form.getCustomClosedFormMessage(); console.log(message);
رحلة العودة
String
— الرسالة المخصصة التي سيتم عرضها إذا كان النموذج لا يقبل الاستجابات أو سلسلة فارغة إذا لم يتم ضبط رسالة مخصصة.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getDescription()
الحصول على وصف النموذج.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets the form description. form.setDescription('This is the form description.'); // Gets the form description and logs it to the console. const description = form.getDescription(); console.log(description);
رحلة العودة
String
: وصف النموذج
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getDestinationId()
الحصول على رقم تعريف وجهة الرد على النموذج
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Creates a spreadsheet to use as the response destination. const ss = SpreadsheetApp.create('Test_Spreadsheet'); // Updates the form's response destination. form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId()); // Gets the ID of the form's response destination and logs it to the console. const destinationId = form.getDestinationId(); console.log(destinationId);
رحلة العودة
String
- رقم تعريف وجهة استجابة النموذج.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getDestinationType()
الحصول على نوع وجهة الرد على النموذج
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc1234556/edit'); // Gets the type of the form's response destination and logs it to the console. const destinationType = form.getDestinationType().name(); console.log(destinationType);
رحلة العودة
DestinationType
: نوع وجهة استجابة النموذج.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getEditUrl()
يحصل على عنوان URL الذي يمكن استخدامه للوصول إلى وضع التعديل في النموذج.
// Opens the form by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the URL that accesses the form's edit mode and logs it to the console. const url = form.getEditUrl(); console.log(url);
رحلة العودة
String
: عنوان URL لتعديل النموذج
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getEditors()
getId()
الحصول على رقم تعريف النموذج
// Opens the form by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the ID of the form and logs it to the console. const id = form.getId(); console.log(id);
رحلة العودة
String
: رقم تعريف النموذج
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getItemById(id)
الحصول على العنصر باستخدام معرّف معيّن يعرض null
إذا كان رقم التعريف لا يتوافق مع عنصر في النموذج.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the ID of the first item on the form. const itemId = form.getItems()[0].getId(); // Gets the item from the ID. const item = form.getItemById(itemId); // Gets the name of the item type and logs it to the console. const type = item.getType().name(); console.log(type);
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
id | Integer | رقم تعريف السلعة |
رحلة العودة
Item
: العنصر الذي يحمل المعرّف المحدّد أو null
في حال عدم توفّر العنصر في النموذج
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getItems()
للحصول على صفيف من كل العناصر في النموذج.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the list of items in the form. const items = form.getItems(); // Gets the type for each item and logs them to the console. const types = items.map((item) => item.getType().name()); console.log(types);
رحلة العودة
Item[]
: مصفوفة من جميع العناصر في النموذج.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getItems(itemType)
للحصول على مصفوفة من جميع العناصر من نوع معيّن.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets a list of all checkbox items on the form. const items = form.getItems(FormApp.ItemType.CHECKBOX); // Gets the title of each checkbox item and logs them to the console. const checkboxItemsTitle = items.map((item) => item.asCheckboxItem().getTitle()); console.log(checkboxItemsTitle);
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
itemType | ItemType | نوع العناصر المطلوب استردادها |
رحلة العودة
Item[]
: مصفوفة من جميع العناصر من هذا النوع
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getPublishedUrl()
الحصول على عنوان URL الذي يمكن استخدامه للردّ على النموذج
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the URL to respond to the form and logs it to the console. const url = form.getPublishedUrl(); console.log(url);
رحلة العودة
String
: عنوان URL للردّ على النموذج.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getResponse(responseId)
يحصل على رد نموذج واحد استنادًا إلى رقم تعريف الاستجابة. يمكن استرداد أرقام تعريف الاستجابة من FormResponse.getId()
.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
responseId | String | رقم تعريف استجابة النموذج. |
رحلة العودة
FormResponse
: الردّ على النموذج
رمي
Error
: في حال عدم توفُّر الرد
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getResponses()
الحصول على مجموعة من جميع ردود النموذج
رحلة العودة
FormResponse[]
: مصفوفة من الردود على النموذج.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getResponses(timestamp)
يحصل على صفيف من جميع ردود النموذج بعد تاريخ ووقت معيّنَين.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
timestamp | Date | أقرب تاريخ ووقت يجب عرض الردود على النموذج لهما. |
رحلة العودة
FormResponse[]
- قائمة الردود على النموذج
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getShuffleQuestions()
وتحدّد هذه السياسة ما إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا.
رحلة العودة
Boolean
— true
إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا.
false
إذا لم يكن الأمر كذلك.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getSummaryUrl()
الحصول على عنوان URL الذي يمكن استخدامه لعرض ملخّص لردود النموذج ما لم يتم ضبط السياسة setPublishingSummary(enabled)
على true
، لن يتمكّن سوى المستخدمين الذين لديهم إذن تعديل
في النموذج من الوصول إلى عنوان URL.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // Opens the form by its URL. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the URL to view a summary of the form's responses and logs it to the console. const url = form.getSummaryUrl(); console.log(url);
رحلة العودة
String
: عنوان URL لعرض ملخّص بالردود.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getTitle()
الحصول على عنوان النموذج
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets the title of the form to 'For_Testing.' form.setTitle('For_Testing'); // Gets the title of the form and logs it to the console. const title = form.getTitle(); console.log(title);
رحلة العودة
String
: عنوان النموذج
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
hasLimitOneResponsePerUser()
يحدد هذا الإعداد ما إذا كان النموذج يسمح برد واحد فقط لكل مجيب. وإذا كانت القيمة هي true
، لا يمكن للنص البرمجي إرسال ردود على الإطلاق على الإطلاق.
رحلة العودة
Boolean
- true
إذا كان النموذج يسمح برد واحد فقط لكل مجيب، أو false
إذا لم يسمح بذلك.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
hasProgressBar()
تحدِّد هذه السياسة ما إذا كان النموذج يعرض شريط تقدّم.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // Opens the form by its URL. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Displays the progress bar on the form. form.setProgressBar(true); // Checks if the form displays a progress bar and logs it to the console. console.log(form.hasProgressBar());
رحلة العودة
Boolean
— true
إذا كان النموذج يعرض شريط التقدم، وfalse
إذا لم يعرضه.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
hasRespondAgainLink()
تحدد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد إكمال النموذج.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets the form to display a link to submit another // response after someone submits the form. form.setShowLinkToRespondAgain(true); // Checks if the form displays a 'Submit another response' link and logs it to the console. console.log(form.hasRespondAgainLink());
رحلة العودة
Boolean
- true
إذا كان النموذج يعرض رابط "إرسال رد آخر"، false
إذا لم يكن كذلك.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
isAcceptingResponses()
ويحدّد ما إذا كان النموذج يقبل الردود حاليًا.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets the form to accept responses. form.setAcceptingResponses(true); // Checks if the form is accepting responses or not and logs it to the console. const accepting = form.isAcceptingResponses(); console.log(accepting);
رحلة العودة
Boolean
- true
إذا كان النموذج يقبل الردود، false
إذا لم يكن يقبلها.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
isPublishingSummary()
تحدّد هذه السياسة ما إذا كان النموذج يعرض رابطًا لعرض ملخّص الردود بعد إكمال النموذج.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets the form to display a link to a summary of // the responses after someone submits the form. form.setPublishingSummary(true); // Checks if the form displays a "See previous responses" link and logs it to the console. const publishingLink = form.isPublishingSummary(); console.log(publishingLink);
رحلة العودة
Boolean
- true
إذا كان النموذج يعرض رابط "عرض الردود السابقة"، false
إذا لم يكن كذلك.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
isQuiz()
تُحدِّد هذه السمة ما إذا كان النموذج عبارة عن اختبار.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets the form as a quiz. form.setIsQuiz(true); // Checks if the form is a quiz or not and logs it to the console. console.log(form.isQuiz());
رحلة العودة
Boolean
- true
إذا كان النموذج يقبل الردود، false
إذا لم يكن يقبلها.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
moveItem(from, to)
لنقل عنصر في فهرس معين بين جميع العناصر في النموذج إلى فهرس آخر. تجاهل استثناء النص البرمجي إذا كان فهرس to
خارج الحدود.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Moves the first item to be the last item. form.moveItem(0, form.getItems().length - 1);
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
from | Integer | الفهرس الحالي للعنصر بين جميع العناصر في النموذج |
to | Integer | الفهرس الجديد للعنصر بين جميع العناصر في النموذج |
رحلة العودة
Item
— العنصر الذي تم نقله
رمي
Error
إذا كان أي من الفهرس خارج الحدود.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
moveItem(item, toIndex)
نقل عنصر معيّن إلى فهرس معيّن بين جميع العناصر في النموذج طرح نص برمجي باستثناء إذا كان الفهرس المحدد خارج الحدود
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the first item. const item = form.getItems()[0]; // Moves the item to be the last item. form.moveItem(item, form.getItems().length - 1);
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
item | Item | العنصر المطلوب نقله. |
toIndex | Integer | الفهرس الجديد للعنصر بين جميع العناصر في النموذج |
رحلة العودة
Item
— العنصر الذي تم نقله
رمي
Error
: إذا كان الفهرس خارج الحدود.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
removeDestination()
يؤدي هذا الخيار إلى إلغاء ربط النموذج بوجهة الاستجابة الحالية. وتحتفظ الوجهة السابقة التي تم إلغاء ربطها بنسخة من كل الردود السابقة. كل النماذج، بما في ذلك النماذج التي لم يتم ضبط وجهة لها صراحةً، احفظ نسخة من الردود في مخزن الردود على النموذج. إذا لم يكن للنموذج وجهة للاستجابة حاليًا، لن يكون لهذه الطريقة أي تأثير.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Opens a spreadsheet to use for the response destination. // TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit'); // Updates the form's response destination to the spreadsheet. form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId()); // Unlinks the form from the spreadsheet. form.removeDestination();
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
removeEditor(emailAddress)
يزيل المستخدم المحدد من قائمة أدوات تحرير Form
. ولا تمنع هذه الطريقة المستخدمين من الوصول إلى Form
إذا كانوا ينتمون إلى فئة مستخدمين لديهم إذن الوصول العام، مثلاً في حال مشاركة Form
مع نطاق المستخدم بالكامل، أو إذا كانت Form
في مساحة تخزين سحابي مشتركة يمكن للمستخدم الوصول إليها.
بالنسبة إلى ملفات Drive، يؤدي ذلك أيضًا إلى إزالة المستخدم من قائمة المشاهدين.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
emailAddress | String | عنوان البريد الإلكتروني للمستخدم المطلوب إزالته. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
removeEditor(user)
يزيل المستخدم المحدد من قائمة أدوات تحرير Form
. ولا تمنع هذه الطريقة المستخدمين من الوصول إلى Form
إذا كانوا ينتمون إلى فئة مستخدمين لديهم إذن الوصول العام، مثلاً في حال مشاركة Form
مع نطاق المستخدم بالكامل، أو إذا كانت Form
في مساحة تخزين سحابي مشتركة يمكن للمستخدم الوصول إليها.
بالنسبة إلى ملفات Drive، يؤدي ذلك أيضًا إلى إزالة المستخدم من قائمة المشاهدين.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
user | User | تمثيل للمستخدم المطلوب إزالته |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
requiresLogin()
ويحدّد ما إذا كان النموذج يتطلب من المشاركين تسجيل الدخول إلى حساب في النطاق نفسه أو نطاق فرعي قبل الرد.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Checks if the form requires respondents to log in to a Google Workspace account // before responding and logs it to the console. const login = form.requiresLogin(); console.log(login);
رحلة العودة
Boolean
— true
إذا كان النموذج يتطلب من المستخدمين تسجيل الدخول، وfalse
إذا لم يكن مطلوبًا.
setAcceptingResponses(enabled)
يحدّد ما إذا كان النموذج يقبل الردود حاليًا. الإعداد التلقائي للنماذج الجديدة هو true
.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets the form to accept responses. form.setAcceptingResponses(true); // Checks whether the form is accepting responses or not and logs it to the console. console.log(form.isAcceptingResponses());
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
enabled | Boolean | true إذا كان النموذج يجب أن يقبل الردود، false إذا لم يكن مقبولاً. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setAllowResponseEdits(enabled)
لضبط ما إذا كان النموذج يعرض رابطًا لتعديل الرد بعد إرساله. الإعداد التلقائي
للنماذج الجديدة هو false
.
بغض النظر عن هذا الإعداد، تسمح الطريقة FormResponse.getEditResponseUrl()
لمؤلف النص البرمجي الذي لديه إذن تعديل بالنموذج بإنشاء عنوان URL يمكن استخدامه لتعديل استجابة.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Shows "Edit your response" link after someone submits the form. form.setAllowResponseEdits(true); // Checks whether the option to edit the form after a user submits it is set to true or not // and logs it to the console. console.log(form.canEditResponse());
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
enabled | Boolean | true إذا كان النموذج يجب أن يعرض رابط "تعديل ردّك"، false إذا لم يكن كذلك. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setCollectEmail(collect)
لضبط ما إذا كان النموذج يجمع عناوين البريد الإلكتروني للمجيبين. الإعداد التلقائي للنماذج الجديدة هو
false
.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets the form to collect respondents' email addresses. form.setCollectEmail(true); // Checks whether the value is set to true or false and logs it to the console. const collect = form.collectsEmail(); console.log(collect);
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
collect | Boolean | true إذا كان النموذج يجب أن يجمع عناوين البريد الإلكتروني، false إذا لم ينفِّذها. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setConfirmationMessage(message)
إعداد رسالة التأكيد للنموذج
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets a custom confirmation message to display after someone submits the form. form.setConfirmationMessage('Your form has been successfully submitted.'); // Gets the confirmation message set for the form and logs it to the console. const message = form.getConfirmationMessage(); console.log(message);
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
message | String | رسالة التأكيد الجديدة في النموذج. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setCustomClosedFormMessage(message)
لضبط الرسالة لعرضها في حال عدم قبول النموذج للردود في حال عدم ضبط أي رسالة، يستخدم النموذج رسالة تلقائية.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets the form to not accept responses. form.setAcceptingResponses(false); // Sets a custom closed form message to display to the user. form.setCustomClosedFormMessage('The form is no longer accepting responses.'); // Gets the custom message set for the form and logs it to the console. const message = form.getCustomClosedFormMessage(); console.log(message);
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
message | String | الرسالة التي سيتم عرضها إذا كان النموذج لا يقبل الاستجابات. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setDescription(description)
لضبط وصف النموذج.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
description | String | الوصف الجديد للنموذج. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setDestination(type, id)
لضبط الوجهة التي يتم فيها حفظ الردود على النموذج. كل النماذج، بما في ذلك النماذج التي لم يتم ضبط وجهة لها صراحةً، احفظ نسخة من الردود في مخزن الردود على النموذج.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
type | DestinationType | نوع وجهة استجابة النموذج. |
id | String | رقم تعريف وجهة استجابة النموذج. |
رحلة العودة
رمي
Error
: في حال كان رقم تعريف الوجهة غير صالح
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setIsQuiz(enabled)
تحدد ما إذا كان النموذج اختبارًا. الإعداد التلقائي للنماذج الجديدة هو false
.
لا يُسمح بطرح الأسئلة إلا في الاختبارات، لذا يؤدي ضبط القيمة على false
إلى إزالة جميع خيارات وضع الدرجات من جميع الأسئلة.
لا تتوفر إعدادات الاختبار إلا في واجهة مستخدم "نماذج Google" الجديدة. ويؤدي إنشاء نموذج للاختبار إلى تفعيل النموذج باستخدام واجهة المستخدم الجديدة.
// Opens the Forms file by its URL. If you created your script from within a // Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Makes the form a quiz. form.setIsQuiz(true); // Checks whether the form is a quiz or not and logs it to the console. console.log(form.isQuiz());
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
enabled | Boolean | true إذا كان يجب تفعيل ميزات الاختبار في النموذج، false إذا لم يتم تفعيلها. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setLimitOneResponsePerUser(enabled)
لضبط ما إذا كان النموذج يسمح برد واحد فقط لكل مجيب. الإعداد التلقائي للنماذج الجديدة هو
false
. في حال ضبط القيمة على true
، لن يرسل النص البرمجي ردود النموذج على الإطلاق.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
enabled | Boolean | true إذا كان النموذج يجب أن يسمح برد واحد فقط لكل مجيب، وfalse إذا لم يكن. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setProgressBar(enabled)
إعداد ما إذا كان النموذج يحتوي على شريط التقدم الإعداد التلقائي للنماذج الجديدة هو false
.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Displays the progress bar on the form. form.setProgressBar(true); // Checks whether the form has a progress bar and logs it to the console. console.log(form.hasProgressBar());
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
enabled | Boolean | true إذا كان النموذج يعرض شريط التقدم، false إذا لم يظهر. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setPublishingSummary(enabled)
يتم تحديد ما إذا كان النموذج يعرض رابطًا لعرض ملخّص الردود بعد أن يرسل المُجيب النموذج. الإعداد التلقائي للنماذج الجديدة هو false
.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
enabled | Boolean | true إذا كان النموذج يجب أن يعرض رابط "عرض الردود السابقة"، false إذا لم يكن كذلك. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setRequireLogin(requireLogin)
لضبط ما إذا كان النموذج يتطلب من المشاركين تسجيل الدخول إلى حساب في النطاق نفسه أو نطاق فرعي قبل الرد. الإعداد التلقائي للنماذج الجديدة هو false
ما لم يغيّر مشرف النطاق الإعداد التلقائي.
لا تتوفّر هذه الميزة إلا للنماذج التي أنشأها مستخدمو Google Workspace. ولن يُطلب من مستخدمي الأنواع الأخرى من حسابات Google تسجيل الدخول.
// Opens the Forms file by its URL. If you created your script from within // a Google Forms file, you can use FormApp.getActiveForm() instead. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Sets the form so that users must log in to their Google Workspace account. form.setRequireLogin(true); // Checks whether the form requires login or not and logs it to the console. console.log(form.requiresLogin());
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
requireLogin | Boolean | true إذا كان النموذج يتطلّب من المستخدمين تسجيل الدخول، وfalse في حال لم يسجّل النموذج. |
رحلة العودة
Form
— النموذج الحالي (للسلسلة).
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setShowLinkToRespondAgain(enabled)
لضبط ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد إكمال النموذج. الإعداد التلقائي للنماذج الجديدة هو true
.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
enabled | Boolean | true إذا كان النموذج يجب أن يعرض رابط "إرسال رد آخر"، false إذا لم يكن كذلك. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setShuffleQuestions(shuffle)
لتحديد ما إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
shuffle | Boolean | true إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا، false إذا لم يكن عشوائيًا. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setTitle(title)
ضبط عنوان النموذج
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
title | String | العنوان الجديد للنموذج. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
shortenFormUrl(url)
لتحويل عنوان URL طويل لنموذج إلى عنوان URL قصير. ويتم طرح استثناء إذا كان عنوان URL الطويل لا ينتمي إلى "نماذج Google".
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
url | String | عنوان URL المطلوب اختصاره. |
رحلة العودة
String
: عنوان URL على النحو http://goo.gl/forms/1234
.
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
submitGrades(responses)
إرسال الدرجات لـ FormResponses المحددة.
إذا كان الرمز يحتوي على مشغِّل onFormSubmit
، يؤدي طلب submitGrades()
إلى تنفيذ الشرط onFormSubmit
وتكرار بلا نهاية. لمنع التكرار اللانهائي، أضِف الرمز الذي يتحقّق مما إذا كانت الدرجات متوفّرة قبل طلب submitGrades()
.
المعلّمات
الاسم | النوع | الوصف |
---|---|---|
responses | FormResponse[] | مصفوفة من جميع ردود النموذج. |
رحلة العودة
التفويض
إنّ النصوص البرمجية التي تستخدم هذه الطريقة تتطلب تفويضًا باستخدام واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms