0
我有一个Google表单,我已经创建了用于类注册的Google表单。当用户点击提交按钮触发onSubmit事件时,我正在编写我的第一个Google脚本(基于我从Google教程材料中学到的内容)来调用HTML页面。当点击提交按钮时Google窗体脚本调用HTML页面
调用HTML页面的原因是指导用户选择页面中包含的PayPal选项。我看不到将它们添加到提交后显示的“设置”页面的方法。或表单本身,所以我决定创建第二页。
我拼凑起来的代码(是的,我是小白)是
function goToPayment() {
//onSubmit, goes to the PayPal payment page so
//that users pay for the class
function doGet(request) {
return HtmlService.createTemplateFromFile('PayPayPayment.html')
.evaluate()
.setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename)
.getContent();
}
}
,这个调用是页面:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<h1>Payment</h1>
<p>
Complete registration for the Introduction to Arduino
class by paying for it with PayPal. All major credit
cards accepted.
</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="PutValueHere">
<table>
<tr><td><input type="hidden" name="on0" value="Early bird pricing!">Early bird pricing!</td></tr><tr><td><select name="os0">
<option value="Member price (before May 11th) - kit, instruction, lunch">Member price (before May 11th) - kit, instruction, lunch $145.00 USD</option>
<option value="Member price (before May 11th) - instruction, lunch">Member price (before May 11th) - instruction, lunch $50.00 USD</option>
<option value="Non-member price (before May 11th) - kit, instruction, lunch">Non-member price (before May 11th) - kit, instruction, lunch $165.00 USD</option>
<option value="Non-member price (before May 11th) - instruction, lunch">Non-member price (before May 11th) - instruction, lunch $60.00 USD</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynow_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</body>
</html>
脚本通过单元测试,但不当我测试表单时被调用。有关如何完成此任务的任何想法或建议?接受有关解决方法的建议以及我应该在哪里修复我的代码。
它看起来像'的doGet()'函数是'goToPayment('功能块的内部。那是故意的? “goToPayment('函数,是由”On Form Submit“事件触发的函数? –
您无法使用Google表单打开另一个Web应用程序,您已经知道如何创建Apps脚本Web应用程序,所以您可以使用它来代替Google表单,Google表单可以快速连续处理多个表单提交,但如果这不太可能,您可能不必担心。 –