Google Apps脚本:调用google.script.run时表单提交失败

时间:2015-07-01 08:27:58

标签: google-apps-script

从2015年6月24日起,我在GAS遇到了问题。之前,一切正常,但现在不行了。

此处的代码可见scriptLink 并且可执行executeLink

我使用HTMLService。我有get方法:

function doGet(request) {
  var template = HtmlService.createTemplateFromFile('Form.html');
  return template.evaluate().setSandboxMode(HtmlService.SandboxMode.NATIVE);
}

Form.html包含:

<input type="button" value="1 STEP - Error Call" onclick="console.log('chiamo il server con input testo...'); google.script.run.withFailureHandler(setBlankFullName).withSuccessHandler(setFullName).getTest('test')" />
<input type="button" value="1 STEP - Correct Call" onclick="console.log('chiamo il server con input form...'); google.script.run.withFailureHandler(setBlankFullName).withSuccessHandler(setFullName).getTest(document.getElementById('myForm'))" />
<br/>
<input type="button" value="2 STEP - SUBMIT"  
  onclick="google.script.run
      .withFailureHandler(onFailure)
      .withSuccessHandler(updateOutput)          
      .processForm(document.getElementById('myForm'));" />

如果我点击按钮&#34; 1 STEP - 错误呼叫&#34;然后&#34; 2 STEP - SUBMIT&#34;我收到此错误:表单提交失败。 为什么呢?

如果我点击按钮&#34; 1 STEP - 正确呼叫&#34;这是非常奇怪的。然后&#34; 2 STEP - SUBMIT&#34;表格工作正常! 不同之处在于输入参数的类型。 要操作我的表单的所有调用,我必须传入输入参数始终相同的数据类型:在这种情况下:表单。如果更改字符串中的所有输入参数,则表单正常工作,如果至少有一个不同的类型,则表单返回表单提交失败。

我不明白为什么会出现此错误,而在支持不同的数据类型之前。

0 个答案:

没有答案