0
votes

I was working on a web app in google app 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?

1
I think you need to concatenate strings with the plus operator. ScriptApp.getService().getUrl() + "?views=log" Alan Wells
I have already tried + and concat() both and the resulted URL is the second one above!Navneet
action="<?=ScriptApp.getService().getUrl()+'?views=log';?>">Navneet

1 Answers

1
votes

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!