0
votes

I am trying to pass a parameter from a webapp link, so it can be used to pre-fill an html form (using HtmlService).

Apps Script -

function doGet(e) {
  var formId = e.parameter.formId;

  return HtmlService.createTemplateFromFile('Index')
      .id = formId
      .evaluate()
      .setSandboxMode(HtmlService.SandboxMode.IFRAME)
}  

Index.html -

<form id="myForm">
  <input type="text" name="formId" value="<?=id?>"><br>
  <input type="search" name="search">
</form>

Error received -

Cannot find function evaluate in object "xyz" (where xyz is the parameter included in the link).

I am not sure what I am doing wrong with the Apps Script code.

Many thanks in advance.

Happy coding!

1

1 Answers

1
votes
var html =     HtmlService.createTemplateFromFile('Index')
  html.id = formId;
return html.evaluate()