我已经能够使用函数getColumnIndex(label)成功找到索引值,然后将该函数返回到函数getColumnValues(index)中,以拉出该特定列中的所有行。我似乎无法使用自动完成问题id =“ courseCode”中的输入字段输入课程代码作为要在函数getExpectations()中使用的搜索字符串。将HTML页面问题id =“期望”填充为多选问题。
如果我手动添加搜索字符串文本以返回列行,则可以使用。我想使用输入字段id =“ courseCode”的前4个字符作为搜索字符串,输入课程代码(3个字母,后跟一个数字),以确定哪些选择选项将填充id =“ expectations”问题。
我对在另一个函数中调用函数以及何时以及如何使用参数/条件来传递函数感到困惑。
我希望这是足以解决我的脚本错误的信息。在此先感谢您的关注。保重。
添加了以下代码行,以便在多选课程期望问题中选择所有选项。
function collectForm(){
var submission = {};
// gets you the values for all id="specific_names"
submission.grade = document.getElementById("grade").value;
submission.courseCode = document.getElementById("courseCode").value;
var list = document.getElementsByClassName('selectedExpectations');
var selection = ' ';
for (i = 0; i < list.length; i++){
if (list[i].checked === true) {
selection += list[i].value + ", ";
}
}
submission.expectations = selection;
google.script.run.userClicked(submission);
}
您需要这样的东西