0

I have written some code in Google Apps Script that generates a custom form (with some textboxes and a submit button) in the home page of a Google Site using the doGet() method.

What I now want is that, by clicking the submit button, and depending on the answers of the textboxes, load a new HTML code (generating another form).

For example, suppose that the user writes an email address in one of the textboxes. Two things may happen: either the email is not in the spreadsheet or it is. In the former case I want the code to load a sign-in form; in the latter, I want the code to show another form.

How can I do this?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
  • Please have a look at [How to ask good questions here](http://stackoverflow.com/help/how-to-ask). – sjsam Dec 07 '15 at 18:38
  • You will need to learn about the DOM if you don't already know about it. The DOM (Document Object Model) is not JavaScript, but works together with JavaScript. With DOM methods and properties you can do things like show and hide HTML elements. [Display property](http://www.w3schools.com/jsref/prop_style_display.asp) The DOM [DOM Information](http://www.w3schools.com/js/js_htmldom.asp) – Alan Wells Dec 07 '15 at 19:29
  • this is covered in similar questions already. you cannot navigate to a new html page. instead you build/unhide html elements on the same page. – Zig Mandel Dec 07 '15 at 19:39
  • Sure, you can show different html files. They will be the same base URL, but by passing parameters in the URL and handling them in your `doGet()`, you can effectively post different pages. See [Linking to another HTML page in Google Apps Script](http://stackoverflow.com/questions/15668119/linking-to-another-html-page-in-google-apps-script). – Mogsdad Dec 08 '15 at 01:33

1 Answers1

0

While we cannot provide you a full working code here.

You can talk to the back end using google.script.run from the front end javascript

Test the response and proceed as needed.

Karan
  • 1,187
  • 2
  • 9
  • 16