[英]How to make a google form using apps script
I want to make a google form in apps script that will be like an inventory check out/in form. 我想在应用程序脚本中制作一个Google表单,就像库存签出/签入表单一样。 I want all the options to be under the check out section and every time a response gets submitted for checking out an item, the next time the form opens that item will appear under the check in section.
我希望所有选项都在“检出”部分下,并且每次提交用于检出项目的响应时,下次打开该表单的表单都将出现在“检入”部分下。 I also want the item to go from check in to check out as well but I'm not even sure that functionality is available, just thought I'd put it out there.
我也希望该项目也能从签入到签出,但我什至不确定该功能是否可用,只是以为我会把它放在那里。 I started creating the form but I'm not sure where to go from here, the documentation for apps script isn't the most detailed.
我开始创建表单,但不确定从何处去,有关应用程序脚本的文档不是最详细。
//variable for new form
var newForm = FormApp.create('CS IT Checkout Form test');
//making name field
var name = newForm.addTextItem();
//variable for email
var email = newForm.addTextItem();
//variable for checkout checkboxes
var checkBoxItem = newForm.adCheckBoxItem();
//variable for checkin checkboxes
var checkBoxItem2 = newForm.addCheckboxItem();
function myFunction() {
//making description
newForm.setDescription('Checkout and check-in form for CS tech');
//making name field
//at some point make the name field required or just do it in actual
form
name.setTitle('Name');
//making email field
email.setTitle('Email')
//making checkout equipment fields
checkoutItem.setTitle('Check Out');
//default options until responses are made then it begins to change
checkBoxItem.setChoiceValues(['Laptop', 'Tablet', 'Monitor', 'Camera']);
//once form submissions start values will be put in the check in section
checkBoxItem2.setTitle('Check In');
checkBoxItem2.setChoiceValues();
}
Writing this as an answer rather than a comment because formatting. 将其写为答案而不是评论是因为格式化。
First you have to figure out a flow that would work for what you want. 首先,您必须弄清楚适合您想要的流程。 Does this sound about right?
这听起来对吗?
I think you need a form, and an inventory spreadsheet connected to that form. 我认为您需要一个表单,以及与此表单连接的库存电子表格。
The form asks the user whether it is a check/check out choice, and then the user select the appropriate item from the correct dropdown (check in or check out). 该表格会询问用户这是否为签入/签出选项,然后用户从正确的下拉列表中选择适当的项目(签入或签出)。 I think you can tie this logic to a first page yes/no, but I haven't tried it.
我认为您可以将此逻辑绑定到首页是/否,但是我还没有尝试过。 So worst case scenario three questions and they leave one dropdown blank.
因此,最坏的情况是三个问题,它们留空了一个下拉列表。 tie the form to the spreadsheet.
将表单绑定到电子表格。
You need an onsubmit function in the spreadsheet that does the following: 您需要在电子表格中执行以下操作的onsubmit函数:
Now it is ready for the next usage. 现在已准备好下次使用。 Is this what you envision?
这是您所设想的吗?
实际上,我不需要将信息存储在工作表中,而是想出了如何通过创建一个函数来获取最新响应并将其传递给另一个为新部分创建新选择的函数的方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.