I had this script running for a few months and it was working well, but now I am getting the following response when trying to submit a form
{"result":"error","error":{"parameter":{"number":"2","size":"8x10","name":"Blake Tiggemann","email":"[email protected]"},"contextPath":"","contentLength":72,"queryString":"","parameters":{"number":["2"],"size":["8x10"],"name":["Blake Tiggemann"],"email":["[email protected]"]},"postData":{"type":"application/x-www-form-urlencoded","length":72,"contents":"name=Blake+Tiggemann&email=blaketiggemann%40gmail.com&size=8x10&number=2","name":"postData"}}}
I tried re-publishing the script, but that did not work.
This script has been super handy for a non-programmer like myself..but now that it stopped I unfortunately don't know how to fix it!
Any help would be appreciated!
I got the same problem as well, but now I switch to using nodemailer and it works very well.
Having the same issues lately. If I run the app link directly it give this message:
Script function not found: doGet
If I submit the form on the website it is deployed I am getting the same result as @itsblakewillis above (although mine has my custom fields in it).
Using this for a business and need resolved soon so we do not lose customers.
I tried the updated code provided and still got the same error. When I changed the triggers I had setup to use different options it suddenly worked. My "confirmation" portion of my site is not working, but the form is at least submitted again.
EDIT > Current Project Triggers
Add:
doPost and record_data
From Spreadsheet
On form_submit
Not sure why this suddenly fixed the issue, but hopefully it stays working again.
not sure what is going on.
can anyone share a broken example?
I've been unable to recreate it so can't fix it.
we made a large change that requires the class name to be set to gform.
@gregimagines - are you using a google form, or your own html form? from what I can tell, the doPost should trigger when you send a POST request via an HTML form, which is what this tutorial is aimed at. Google Script has "simple triggers" which just use default names so that you don't need to set up your own triggers manually... not sure why you had to do that to fix it. https://stackoverflow.com/questions/45155847/google-script-project-trigger-not-running
@mckennapsean, I am using a custom html form. I used the new code provided and had to change a few things to reflect using the class instead of id. Everything works now except for the thank you message. I鈥檝e gone through the other posts about it and gone over the steps several times. Still just getting the code instead of thank you. Tried linking to the js file and putting the file on the site and even in the index page but same results.
so submitting the form is working but the webpage becomes JSON or the form submission result? that means the clientside JS isn't working. you'd need to check your console logs to see why that is the case, or possibly debug it.
That was my thought but nothing appears in the console and log. Everything appears to run smoothly but actually doesn鈥檛. After submitting, the info is emailed and stored in the spreadsheet, but the page goes to the message mentioned at the start, although as a success instead of error. Not sure why it wouldn鈥檛 be running since I have it locally and it says it is loading properly.
It likely isn't producing errors due to the silent null checks we use now. You'd have to step through to see what is happening, but I bet the form listener isn't getting attached to the form. If you can abstract your form into a simple example and share it then I could take a look and try to help. We have a link to a sample in codepen on the FAQs at the end!
I鈥檒l try to pull it up when I鈥檓 back at work on amp day. Thanks.
If anyone has this problem, try hosting the javascript on your server and changing the id to class on the form.
glad to hear this error was resolved!
@itsblakewillis Thanks again for opening (_and closing_) this issue
and sharing your solution with the community. 馃帀
hosting the JS on your "server" _kinda_ "defeats the purpose" of the _original_ reason we created this tutorial/script: avoid the need to run a "server" by posting data to Google Spreadsheet ...
But I can see that in _your_ use-case hosting the handler JS and modifying the id to class on the form
is a _good_ approach to solving _this_ issue. 馃憤
For anyone following along facing a _similar_ issue,
you can achieve a similar result _without_ having to run
your own server using the following steps:
Obviously the "follow up question" is:
"_if you don't have a server, where are you hosting the .html form_?"
Again, this can be achieved using a number of _free_ services.
e.g: considering you are already using Google to store the data, you can host the form on a Google Site https://sites.google.com or if you want more (version) control, a GitHub pages site: https://pages.github.com both of which _eliminate_ the need to run/maintain a "server".
Also by server I meant my webhost (I know nothing about servers), shout out to neocities.org , where I host my sites!
Most helpful comment
If anyone has this problem, try hosting the javascript on your server and changing the id to class on the form.