function createFormSection(section, inputNames, opt_prefills) {
  for (var i = 0; i < inputNames.length; i++) {
    var widget = CardService.newTextInput()
      .setFieldName(inputNames[i])
      .setTitle(inputNames[i]);
    if (opt_prefills && opt_prefills[i]) {
      widget.setValue(opt_prefills[i]);
    }
    section.addWidget(widget);
  }

  var submitForm = CardService.newAction().setFunctionName('submitForm');
  var submitButton = CardService.newTextButton()
    .setText('Submit')
    .setOnClickAction(submitForm);
  section.addWidget(CardService.newButtonSet().addButton(submitButton));

  return section;
}
/**
 * Creates form section to be displayed on card.
 *
 * @param {CardSection} section The card section to which form items are added.
 * @param {String[]} inputNames Names of titles for each input field.
 * @param {String[]} opt_prefills Default values for each input field.
 * @returns {CardSection}
 */
Creates form section to be displayed on card.
@param {CardSection} section The card section to which form items are added.
@param {String[]} inputNames Names of titles for each input field.
@param {String[]} opt_prefills Default values for each input field.
Creates form section to be displayed on card . @param { CardSection } section The card section to which form items are added . @param { String [] } inputNames Names of titles for each input field . @param { String [] } opt_prefills Default values for each input field .
function createFormSection(section, inputNames, opt_prefills) {
  for (var i = 0; i < inputNames.length; i++) {
    var widget = CardService.newTextInput()
      .setFieldName(inputNames[i])
      .setTitle(inputNames[i]);
    if (opt_prefills && opt_prefills[i]) {
      widget.setValue(opt_prefills[i]);
    }
    section.addWidget(widget);
  }
  var submitForm = CardService.newAction().setFunctionName('submitForm');
  var submitButton = CardService.newTextButton()
    .setText('Submit')
    .setOnClickAction(submitForm);
  section.addWidget(CardService.newButtonSet().addButton(submitButton));
  return section;
}
function createFormSection ( section , inputNames , opt_prefills ) { for ( var i = 0 ; i < inputNames . length ; i ++ ) { var widget = CardService . newTextInput ( ) . setFieldName ( inputNames [ i ] ) . setTitle ( inputNames [ i ] ) ; if ( opt_prefills && opt_prefills [ i ] ) { widget . setValue ( opt_prefills [ i ] ) ; } section . addWidget ( widget ) ; } var submitForm = CardService . newAction ( ) . setFunctionName ( 'submitForm' ) ; var submitButton = CardService . newTextButton ( ) . setText ( 'Submit' ) . setOnClickAction ( submitForm ) ; section . addWidget ( CardService . newButtonSet ( ) . addButton ( submitButton ) ) ; return section ; }
Creates form section to be displayed on card.
Creates form section to be displayed on card .