-1

I have made index.html file witch contains

<form id="myForm">
Uporabniško ime: <input id="firstName" name="firstName" type="text" /><br>
Geslo: <input id="pass" name="pass" type="text" /><br>

<input type="button" value="Submit" 
 onClick="google.script.run.withSuccessHandler(DataSaved).processForm(this.form)"
        />
</form>
<div id="Message"></div>

Now im struggling to put this content to variable. I would like to put this input fields into var1 and var2. Idealy after submit click script would redirect to different template where i could use this var1 and var2.

The documentation and examples on this topic are limited and difficult to understand. I would appreciate any help.

Jakadinho
  • 701
  • 1
  • 6
  • 16
  • see if this helps you understand passing form input to the server: http://stackoverflow.com/questions/27888364/get-form-input-text-value-to-insert-in-a-google-spreadsheet/27888908?noredirect=1#comment47695644_27888908 – ScampMichael Apr 22 '15 at 23:08

1 Answers1

0

Do you have any script coded in the page? Basically you'll have a global variable or a closure that stores your variables, also, as for best practice, the onClick on takes a Javascript function, not the whole google.script.run, even better would be to insert the function with Jquery, but for your solution:

<script>
var var1, var2;

function saveForm(formSend){
  var1 = formSend.firstName;
  var2 = formSend.pass;
  google.script.run.withSuccessHandler(DataSaved).processForm(formSend);
}

function DataSaved(e){
  console.log(e);
}
</script>

And what do you mean by different teamplate?

Kriggs
  • 3,731
  • 1
  • 15
  • 23