Class QuizFeedbackBuilder

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.
const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
const item = 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)QuizFeedbackBuilderAdds a link to the feedback's supplemental material.
addLink(url, displayText)QuizFeedbackBuilderAdds a link to the feedback's supplemental material.
build()QuizFeedbackBuilds a Feedback of the corresponding type for this builder.
copy()QuizFeedbackBuilderReturns a copy of this builder.
setText(text)QuizFeedbackBuilderSets 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

QuizFeedbackQuizFeedback


copy()

Returns a copy of this builder.

Return

QuizFeedbackBuilderQuizFeedbackBuilder


setText(text)

Sets the feedback text.

Parameters

NameTypeDescription
textStringthe new text

Return

QuizFeedbackBuilder — this QuizFeedbackBuilder, for chaining