I have created a form in Google scripts using an html page, which then calls a javascript function, as documented here. When I run the app, the form loads just fine, but it will not execute the script. How can I make this work?
Here is an example of what I'm trying to do:
<html>
<!--Create Sign Out Form-->
<form id="signOut">
<div>
Destination:
<select name="destination">
<option value="lunch">Lunch</option>
<option value="meeting">Client Meeting</option>
<option value="vacation">Vacation</option>
<option value="sick">Out Sick</option>
<option value="personal">Personal</option>
<option value="home">Working from Home</option>
<option value="scedule">Reduced Schedule</option>
</select>
</div>
<div>
Supervisor:
<select name="supervisor" onselect="google.script.run.withUserObject(this.parentNode).populate(destination)"></select>
</div>
<div>
Start Date:
<input type="date" name="startDate" onselect="google.script.run.withUserObject(this.parentNode).SignOutLibrary.dateSelect()"/>
</div>
<div>
End Date:
<input type="date" name="endDate" onselect="google.script.run.withUserObject(this.parentNode).SignOutLibrary.dateSelect()"/>
</div>
<div>
Details:
<textarea type="text" name="details" style="width: 150px; height: 75px;"></textarea>
</div>
<div>
<input type="button" value="Submit"
onclick="google.script.run
.sendRequest(this.parentNode)"/>
</div>
</form>
</html>
And the scripts it should be calling:
function doGet() {
// Uses html form
return HtmlService.createHtmlOutputFromFile('request_form');
}
SignOutLibrary:
function dateSelect() {
var app = UiApp.createApplication();
var handler = app.createServerHandler("change");
var date = app.createDatePicker().setPixelSize(150, 150).addValueChangeHandler(handler).setId("date");
app.add(date);
return app;
}
function change(eventInfo) {
var app = UiApp.getActiveApplication();
app.add(eventInfo.parameter.date);
return app;
}