我知道issue 1660已被標記爲固定,但我似乎無法獲取從我的htmlservice表單傳遞給我的谷歌應用程序腳本的任何參數。這是我曾嘗試:「google.script.run.function」不從htmlservice傳遞值
<my html file>
<form id="myForm">
<input name="aField" id="aField">
<input type="button" id="submit" value="submit" onclick = "sendData()">
</form>
<script>
function sendData() {
google.script.run.processForm(document.getElementById("myForm"));
}
</script>
</my html file>
<google apps script>
function processForm(value) {
var range = SpreadsheetApp.openById("1234").getRangeByName("testRnage");
range.setValue(value.aField);
}
</google apps script>
使用
<input type="button" id="submit" value="submit" onclick = "google.script.run.processForm(this.parentNode)">
也不起作用。
這兩種方法都會導致以下瀏覽器錯誤:「Uncaught ScriptError:TypeError:Can not call method」setValue「of null。」
任何幫助表示讚賞。謝謝。
如果您覺得您的問題(現在無用,因爲您發現它是一個簡單的錯字)混亂了StackOverflow,您可以自由刪除它。 – nalply