0

I was working on a web app in Google Apps Script but while passing parameters to the URL it didn't work.

<!DOCTYPE html>
<html lang="en">
<head>

</head>

    <body>   
            /**Some Code here*/

      <form id="formsearch" class="col s12" action="<?!=ScriptApp.getService().getUrl()?views=log);?>">
    
/**Some Code here*/ 
            </form>
    </body>
  </html>

Resulted url: https://script.google.com/macros/s/AKfycbwo0KN6CaTT3v650rtjrAGwVVp17NxnFtcF9Wpp3-CL/dev?

or

with other tries: https://script.google.com/macros/s/AKfycbwo0KN6CaTT3v650rtjrAGwVVp17NxnFtcF9Wpp3-CL/devviews=log?

Is there any another way of doing it ? and how to solve this?

3
  • 2
    I think you need to concatenate strings with the plus operator. ScriptApp.getService().getUrl() + "?views=log" Commented Jun 8, 2021 at 14:22
  • I have already tried + and concat() both and the resulted URL is the second one above! Commented Jun 8, 2021 at 14:34
  • action="<?=ScriptApp.getService().getUrl()+'?views=log';?>"> Commented Jun 8, 2021 at 14:36

1 Answer 1

1

Instead of using form action="" for passing the parameters use a href="" at the place of submit button.

               <a href="<?!=loadView('log')?>" class="btn waves-effect waves-light right" type="submit">
                  Log in
                <i class="material-icons right">send</i>
                </a>
function loadView(view=""){
  return (ScriptApp.getService().getUrl()+`?views=${view}`);
}

I really don't know why this happened, if someone knew you could tell me. Thanks!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.