[英]pre-fill google form from google apps script
I have a student registration form, there's student id which is a required field. 我有学生登记表,有学生证,这是必填字段。 I have a google apps script function which tells if this student is registered for any class or not.
我有一个Google Apps脚本功能,该功能可以告诉该学生是否已注册任何课程。 Is there a way to auto-fill the field course registered via calling the google apps script function yes or no.
有没有一种方法可以通过调用google apps脚本函数yes或no自动填写注册的实地课程。
Yes you can create a pre filled response with the forms ID, not that the pre filled fields are showed in the URL 是的,您可以创建带有表单ID的预填充响应,而不是在URL中显示预填充字段
Function formPrefill(formId){
var form = FormApp.openById(formId);
try{
var items = form.getItems();
var formResponse = form.createResponse();
// Prefill SessionId
var formItem = "SOMETHING HERE"
var response = formItem.createResponse(sessionId);
formResponse.withItemResponse(response);
//--------ANOTHER FIELD-------------
formItem = items[4].asMultipleChoiceItem();
response = formItem.createResponse('YOUR FIELD NAME');
formResponse.withItemResponse(response);
}catch(e){catch an error here}
}
check https://developers.google.com/apps-script/reference/forms/form#createresponse 检查https://developers.google.com/apps-script/reference/forms/form#createresponse
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.