Learn-to-send-email-via-google-script-html-no-server: Spreadsheet is not being edited.

Created on 20 Jul 2017  路  6Comments  路  Source: dwyl/learn-to-send-email-via-google-script-html-no-server

I just went through all of the tutorial, except for the styling part, and I can't figure out why the spreadsheet isn't being changed. The emails are being sent, although one field (followers) isn't being sent and is always blank, which is confusing since it's pretty much the same as all the other fields. I could use any help!

https://github.com/erikbZhang/erikbzhang.github.io (the form is on influencer.html)
https://docs.google.com/spreadsheets/d/1vve3PO3k0yrIwLaX29jb5fDc78l611_qE_Kpbh0bpOM/edit?usp=sharing (spreadsheet, you should be able to see the script editor there)

I'm totally stumped. This isn't even my first time working with the script editor, I've created an add-on before on a team.

Any help would be very much appreciated.

Most helpful comment

For saving to a form, the Google Script expects a certain name. I updated your spreadsheet to the name "responses" (note: you have it as publicly edit-able currently).
var sheet = doc.getSheetByName('responses'); // select the responses sheet

This then saved data to your form.

The error message you are receiving in the script is because it is trying to display a thank-you div which does not exist. You can take the Javascript and edit it instead to avoid this, or else include that div on your page.

Lastly, the form expects unique ID's & names for all form elements. There are are two form elements with the followers tag, so neither is being saved it seems. If you change one to referral (and update your spreadsheet column name), then it should work just fine.

Thanks for including the example!

All 6 comments

Now I'm getting this error in console:

Uncaught TypeError: Cannot read property 'style' of null
at HTMLFormElement.handleFormSubmit (form-submission-handler.js:49)
handleFormSubmit @ form-submission-handler.js:49

For saving to a form, the Google Script expects a certain name. I updated your spreadsheet to the name "responses" (note: you have it as publicly edit-able currently).
var sheet = doc.getSheetByName('responses'); // select the responses sheet

This then saved data to your form.

The error message you are receiving in the script is because it is trying to display a thank-you div which does not exist. You can take the Javascript and edit it instead to avoid this, or else include that div on your page.

Lastly, the form expects unique ID's & names for all form elements. There are are two form elements with the followers tag, so neither is being saved it seems. If you change one to referral (and update your spreadsheet column name), then it should work just fine.

Thanks for including the example!

Thanks so much!

Hi, I just copy and pasted a bunch of data into the spreadsheet that has the script on it. For some reason, now the

"Uncaught TypeError: Cannot read property 'style' of null
at HTMLFormElement.handleFormSubmit (form-submission-handler.js:49)
handleFormSubmit @ form-submission-handler.js:49"

is showing up again, and the data is not being saved to the form again.

Codebase:
https://github.com/erikbZhang/landomedia.github.io (the form is on influencer.html)
Website:
paidtopost.tech
Google form code:
https://docs.google.com/spreadsheets/d/1vve3PO3k0yrIwLaX29jb5fDc78l611_qE_Kpbh0bpOM/edit?usp=sharing (I will delete most of the data since it is private).

When in doubt, debug the error with some Javascript, like through your browser's console.

Your form does not have the <span> element so the selector cannot alter the style off of an empty (or null) selection. See the example form here.

On another note, we may want to be more explicit on the required form elements for these "features" since folks are bumping into roadblocks.

I can add this to the FAQs at some point, perhaps clarify in the readme when I go through it. Feel free to post back if your issue was not solved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vlknlvnt picture vlknlvnt  路  4Comments

Brothman picture Brothman  路  3Comments

JintaYadomi picture JintaYadomi  路  3Comments

sidbatra picture sidbatra  路  4Comments

jchesner picture jchesner  路  3Comments