简体   繁体   English

从Google网站将表单发布到外部URL

[英]Posting A Form To An External URL From A Google Site

I've created an external HTML form to be hosted on a site outside of a main site that is coded in Rails. 我创建了一个外部HTML表单,该表单将托管在Rails编码的主站点之外的站点上。 I've tested this using http://htmledit.squarefree.com/ (jsfiddle didn't post to the server) and it works. 我已经使用http://htmledit.squarefree.com/(jsfiddle未发布到服务器)对其进行了测试,并且它可以工作。

However, the client wants to put the form on a Google Sites page. 但是,客户希望将表单放在Google协作平台页面上。 I've added it as a HTML box, but when I submit the form the server doesn't see a peep. 我已将其添加为HTML框,但是在提交表单时,服务器看不到窥视。

The form code is: 表单代码为:

<form action="http://thesite.com/signup_ext" method="post">
  <input type="text" name="first_name" />
  <input type="text" name="last_name" />
  <input type="text" name="email" />
  <input type="submit" name="commit" value="Sign Up" />
</form>

Is this possible to do on Google Sites? 这可以在Google协作平台上进行吗?

You may need to create a Google Apps Script file, and make it a Stand Alone Web App. 您可能需要创建一个Google Apps脚本文件,并使其成为独立的Web应用程序。 A Stand Alone Web App is basically a website that you can't map a domain name to. 独立Web应用程序基本上是一个您无法将域名映射到的网站。 Put the form into the Web App, then put the Apps Script into an Apps Script Gadget in the Google Site. 将表单放入Web App中,然后将Apps脚本放入Google网站中的Apps Script小工具中。

Guide to HTML Service HTML服务指南

You will need to use the client side API to send form data to the Apps Script .gs function. 您将需要使用客户端API将表单数据发送到Apps Script .gs函数。

Google Documentation - google.script.run Google文档-google.script.run

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM