I'm currently trying to make a paperwork wizard using google forms and apps script. At the end of the form, I'm trying to run an Apps Script once the form submits and display a HTML window. I tried using FormApp.getUI()along with the apps event trigger, but I keep getting the error Exception: Cannot call FormApp.getUi() from this context. From other posts it seems like this error is because the trigger runs the script server side. Is there a way to run this script client-side so the HTML window can be displayed?
EDIT: Conditional Sections Google forms this question is different from the one I'm asking now.
EDIT2: Code
Code.gs
function myFunction() {
var lock = LockService.getScriptLock();
var html = HtmlService.createHtmlOutputFromFile('display');
FormApp.getUi() // Or DocumentApp or SlidesApp or FormApp.
.showModalDialog(html, " Let's check if you need to present!");
SpreadsheetApp.flush();
lock.releaseLock();
}
display.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<p>Test</p>
</body>
</html>
Returns an instance of the form editor's user-interface environment that allows the script to add features like menus, dialogs, and sidebars.so you see from this that the ui is not available for the form but just for the editing of the form. You do not have any clientside events available to interact with a google form. You can do what you want to do with a web app. - Cooper