2014-12-25 35 views
2

我有一个谷歌应用脚​​本使用jQuery的,jQuery的UI和jQuery的手机。在HTML是一个简单的形式与一个按钮:由于财产中的非法值失败:背景

<input type="button" value="Submit" 
     onclick="google.script.run 
      .withSuccessHandler(updateOutput) 
      .processForm($('#form'))" /> 

当我加载的web应用程序,并单击按钮,我得到:

3359132324-mae_html_user_bin_i18n_mae_html_user.js:13 Uncaught TypeError: Failed due to illegal value in property: context 

的代码进行模糊处理,我不能弄明白的。我试图在processForm中使用Logger.log,在View - > Logs中没有任何内容出现。执行纪录是:

[14-12-25 17:06:15:613 IST] Starting execution 
[14-12-25 17:06:15:649 IST] Execution succeeded [0.0 seconds total runtime] 

如果我设置一个断点,脚本不会停在那里(我想这是因为它被部署为一个web应用程序,我可以改变这种状况?)

回答

4

processForm()方法期望一个原生HTMLElement参数,而不是jQuery上下文。

试试这个:

<input type="button" value="Submit" 
    onclick="google.script.run 
     .withSuccessHandler(updateOutput) 
     .processForm($('#form').get(0))" /> 

jQuery get()

+3

是的,或者干脆'processForm($( '#形式')[0])'。 – Marventus

相关问题