Google-apps-script – Google Form with an alert

google-apps-scriptgoogle-forms

I created a registration form with Google Forms. Now I would like to have an alert displayed before the submitter starts filling out data.

This is my code:

function onOpen() {
  FormApp.getUi()
      .createMenu('Custom Menu')
      .addItem('Show alert', 'showAlert')
      .addToUi();
}
function showAlert() {
  var ui = FormApp.getUi();
  var result = ui.alert(
     'Lorem ipsum',
     'dolor sit amet, consectetur adipiscing elit',
  ui.ButtonSet.OK);
}

The triggers were set up.
The script works fine but only while a form is in in the editing mode, not in a view mode. Actually I'm the only one who can see the message box. It's not what I meant to ;-). How to show this alert to everyone who is going to fill out my form?

Best Answer

The Forms Service of Google Apps Scripts doesn't have methods for the respondent view. Actually, there isn't a Google Apps Script service or Google API to be used to extend the respondent view of Google Forms.

One alternative is to embed the Google Form in a web page or application that allow the use of alerts, i.e. Google Sites.

References