vendredi 26 février 2021

When press button to go to other pages and it shows sorry unable to open file at this time google appscript

I've tried to build multi web by using google appscript for other people to check or edit their information in database(google spreadsheet), reserve time to photo which also link to google spreadsheet.

However, when I test web in incognito mode to test that anyone can use this web appropriately and when pressing button to go to another page, it just show me 'Sorry but unable to open file at this time, please check the address'. I 've search about how to solve in similar question but nothing works for me. Of course I didn't login many accounts when I deploy web and also very sure that I choose to 'anyone, even anonymous' before I deploy web.

so my question is that how can I fix this? This is some of my Code.gs and HTML

Some of Code.gs

  function doGet(e) {
  var htmlOutput = HtmlService.createTemplateFromFile('home')
  htmlOutput.search = '';
  htmlOutput.search2 = '';
  htmlOutput.message = '';
  return htmlOutput.evaluate()
}

function doPost(e) {
  Logger.log(JSON.stringify(e));
  if(e.parameter.checkdata == 'checkdata'){
    var htmlOutput =  HtmlService.createTemplateFromFile('checkdata');
    htmlOutput.message = '';
    return htmlOutput.evaluate()
  } 
else if (e.parameter.reservetime == 'reservetime'){
      var htmlOutput =  HtmlService.createTemplateFromFile('club');
      return htmlOutput.evaluate()

HTML

<body class="background row align-items-center">

  <div class="container" align = "center">

  <?var url = getUrl();?>
    <form method="post" action="<?= url ?>" >  
  <div class="row justify-content-center mt-4">
    <div class="col-3 d-grid">
      <button type="submit" class="btn btn-primary" value="checkdata" name="checkdata">Check Information</button>
    </div>
    <div class="col-3 d-grid">
      <button type="submit" class="btn btn-primary" value="reservetime" name="reservetime">Reserve Time</button>
    </div>
    <div class="col-3 d-grid">
      <button type="submit" class="btn btn-primary" value="paybook" name="paybook">Upload Slip</button>
    </div>

  </form>
  <h4><?= message ?></h4> 
</div>
  </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
  </body>

As can be seen, from home page if I click 'reserve time button' it will show the error that I mentioned above and I have no idea why.

I am sorry if my question is not clear and if you think you would like to get more information to help me, please feel free to ask me or request me to give some information more.

Thanks for any further assistances.




Aucun commentaire:

Enregistrer un commentaire