简体   繁体   English

Google表单-未填写的字段

[英]Google Form - not filled fields

I started to use a Google Form recently. 我最近开始使用Google表单。 I created: 我建立:

  1. The Google form with some questions, Google表单有一些问题,
  2. Spreadsheet where the script would put the answers 脚本将答案放在哪里的电子表格
  3. An template that would be filled with the answers, converted to PDF and sent to the e-mail address. 模板中将填充答案,将其转换为PDF并发送至电子邮件地址。

Everything works perfectly IF all the Google Form fields had been filled. 如果所有Google表单字段均已填写,则一切运行正常。

If there is at least one field that was left empty - all the answers are put correctly to the spreadsheet but get totally misplaced in the template... (fragment of my code below) 如果至少有一个字段留空-所有答案都正确地放在了电子表格中,但在模板中却完全放错了位置……(下面我的代码片段)

// When Form Gets submitted
function onFormSubmit(e) {
//Get information from form and set as variables
var email_address = "myemail@myemail";
var project_name = e.values[1];
var owner = e.values[2];
var team_members = e.values[5];
var project_initiator = e.values[6];
var stakeholders = e.values[7];
var deadline = e.values[3];
var related_projects = e.values[8];
var deliverables = e.values[4];
var project_summary = e.values[9];
var contribution = e.values[10]; 


// Replace place holder keys,in our google doc template
copyBody.replaceText('keyProjectName', project_name);
copyBody.replaceText('keyOwner', owner);
copyBody.replaceText('keyTeamMembers', team_members);
copyBody.replaceText('keyProjectInitiator', project_initiator);
copyBody.replaceText('keyStakeholders', stakeholders);
copyBody.replaceText('keyDeadline', deadline);
copyBody.replaceText('keyRelatedProjects', related_projects);  
copyBody.replaceText('keyProjectSummary', project_summary);
copyBody.replaceText('keyContribution', contribution);

And a fragment of the template: 和模板的片段:

http://zapodaj.net/images/ce3895cc6614f.png http://zapodaj.net/images/ce3895cc6614f.png

Thank you for any advises, answers.. 谢谢您的任何建议,答案..

The easiest way to fix this issue would be to make all of the questions from your form a required questions. 解决此问题的最简单方法是将表格中的所有问题均设为必填问题。 That way, the user will be unable to leave an answer blank and your template will auto-populate in the correct order. 这样,用户将无法将答案留空,并且您的模板将以正确的顺序自动填充。

Hope that helps 希望能有所帮助

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

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