0

i am trying to submit a form using doPost but i keep getting the "Unknown macro doPost" error.

The templated Html:

<?var url = ScriptApp.getService().getUrl().replace("exec","dev");?>

...

<form action='<?=url?>' method="post">
  <fieldset>
    ...
    <input type="submit" value="Submit"/>
  </fieldset>
</form>

The script:

function doPost(requestInfo){
  Logger.log("Entering doPost()\n");
  return HtmlService.createHtmlOutput("<h1>404</h1>");

}

Any ideas why that's happening?

Giannis Spiliopoulos
  • 2,628
  • 18
  • 27

1 Answers1

3

You are geting error because you are posting the data to a wrong URL. Developer and Execution URL do not only differ by dev/exec. Both the URLs are totally different. To test, just hardcode the devloper URL

Waqar Ahmad
  • 3,716
  • 1
  • 16
  • 27