Reputation: 29123
I have a google apps script using jquery,jquery-ui and jquery-mobile. The html is a simple form with a button:
<input type="button" value="Submit"
onclick="google.script.run
.withSuccessHandler(updateOutput)
.processForm($('#form'))" />
When I load as web app and click on the button I get:
3359132324-mae_html_user_bin_i18n_mae_html_user.js:13 Uncaught TypeError: Failed due to illegal value in property: context
The code is obfuscated and I can't make sense out of it. I tried to use Logger.log in processForm, nothing appears in View -> Logs. Execution transcript is:
[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]
If I set a breakpoint, the script doesn't stop there (I guess this is because it is deployed as a web app, can I change that?)
Upvotes: 2
Views: 3861
Reputation: 49095
The processForm()
method is expecting a native HTMLElement
argument, not a jQuery context.
Try this:
<input type="button" value="Submit"
onclick="google.script.run
.withSuccessHandler(updateOutput)
.processForm($('#form').get(0))" />
See jQuery get()
Upvotes: 4