检查输入字段后无法在 google 表单中找到名称属性

Couldn't find the name attribute in google form after inspecting the input field

https://docs.google.com/forms/d/e/1FAIpQLSe4-5jfzznYBB1UByawdNucFRls2Nt17MgT5K1w_ikKUrByVQ/viewform。这是 link 我的 google 表格。当我检查输入元素时,找不到名称属性。我需要名称属性,以便我可以将我的 HTML 表单数据存储到 google 电子表格中。该属性必须包含类似“entry.***”的值。当我检查输入元素时,显示以下内容时没有任何名称属性:

<input type="text" class="quantumWizTextinputPaperinputInput exportInput" jsname="YPqjbf" autocomplete="off" tabindex="0" aria-labelledby="i1" aria-describedby="i2 i3" dir="auto" data-initial-dir="auto" data-initial-value="">

从哪里获取name属性?

Google 表单是动态生成的

您无法在此处自定义 HTML 元素的属性,因为它是动态生成的。如果您想创建一个表单并更好地控制它的行为方式,并且您想保留与 Google 服务的集成,最好的选择是使用网络应用程序。

Web Apps

这将允许您自定义元素的属性,因为您将编写自己的 HTML。例如,最简单的 Web 应用程序之一如下所示:

function doGet(){

 var HTMLString = "<style> h1,p {font-family: 'Helvitica', 'Arial'}</style>"
 + "<h1>Hello World!</h1>"
 + "<p>Welcome to the Web App";

 HTMLOutput = HtmlService.createHtmlOutput(HTMLString);
 return HTMLOutput
}

更多相关信息链接如下。你可以:

  • 创建您的 Apps 脚本项目
  • 使用链接的 HTML 形式编写上述函数的一个版本。然后,您可以将 onSubmit 事件分配给表单,这将触发 Apps 脚本中的一个函数,以使用其信息更新您的电子表格。您可以使用如下语法从客户端 HTML 调用 Apps 脚本函数:
google.script.run.testFunc()

更多相关信息here

参考资料