如何获取HTML提交按钮以在Code.gs onclick中运行功能?

时间:2019-01-12 07:01:55

标签: html forms google-apps-script web-applications

我有一个HTML对话框,该对话框从Google表格中的自定义菜单运行:

图片:https://imgur.com/a/ENEckSY

当我单击“提交”时,我被引荐到该页面,并且该页面不会加载:https://n-7gqhhvrwsnjsshizaj6wcsxwusoflsyfzubcxdy-0lu-script.googleusercontent.com/userCodeAppPanel

<!DOCTYPE html>
<html>
 <head>
  <base target="_top">
 </head>
 <body onload="addEmailsToWindowFromProp()">
  <form id="myForm">
   <p>Send alert </p><input type="number" id="number"pattern="(0-9)"><p> days before the last valid day.</p>   
   <br><br>
   <input type="button"  class="button" value="Add Another Email" onclick="addEmail()" id="add">
   <br><br>
   <input type="submit" class="submit" onclick="getAddEmailsToWindowFromProp()">
  </form>
  <script>
   function getAddEmailsToWindowFromProp(){
    var test = "test";
    google.script.run
    .withSuccessHandler(function(e){ 
    google.script.host.close();
    })
    .getAddEmailsToWindowFromProp(test);

    //I might have to remove this. 
    //      google.script.host.close();     
  }


  </script>
 </body>
</html>

我希望getAddEmailsToWindowFromProp(test)在Code.gs中运行

0 个答案:

没有答案