Class QuizFeedbackBuilder

  • QuizFeedbackBuilder is used to build Feedback objects and set common properties like display text.

  • It provides methods to add links, set text, build the feedback object, and create a copy.

  • The addLink method can include a display text for the link.

  • The build method finalizes the feedback object.

QuizFeedbackBuilder

The base FeedbackBuilder that contains setters for properties common to all feedback, such as display text. Used to build Feedback objects.

// Open a form by ID and add a new list item.
constform=FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
constitem=form.addListItem();
item.setTitle('Do you prefer cats or dogs?');
item.setChoices([
item.createChoice('Dogs',true),
item.createChoice('Cats',false),
]);
// Add feedback which will be shown for correct responses; ie "Dogs".
item.setFeedbackForCorrect(
FormApp.createFeedback().setText('Dogs rule, cats drool.').build(),
);

Methods

MethodReturn typeBrief description
addLink(url) QuizFeedbackBuilder Adds a link to the feedback's supplemental material.
addLink(url, displayText) QuizFeedbackBuilder Adds a link to the feedback's supplemental material.
build() QuizFeedback Builds a Feedback of the corresponding type for this builder.
copy() QuizFeedbackBuilder Returns a copy of this builder.
setText(text) QuizFeedbackBuilder Sets the feedback text.

Detailed documentation

addLink(url)

Adds a link to the feedback's supplemental material.

Parameters

NameTypeDescription
urlStringthe link to display under the display text

Return

QuizFeedbackBuilder — this QuizFeedbackBuilder , for chaining


addLink(url, displayText)

Adds a link to the feedback's supplemental material.

Parameters

NameTypeDescription
urlStringthe link to display under the display text
displayTextStringthe text to display for the link

Return

QuizFeedbackBuilder — this QuizFeedbackBuilder , for chaining


build()

Builds a Feedback of the corresponding type for this builder.

Return

QuizFeedback QuizFeedback


copy()

Returns a copy of this builder.

Return

QuizFeedbackBuilder QuizFeedbackBuilder


setText(text)

Sets the feedback text.

Parameters

NameTypeDescription
textStringthe new text

Return

QuizFeedbackBuilder — this QuizFeedbackBuilder , for chaining

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.