Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem after submit #3

Closed
carloslencargorges opened this issue Jan 25, 2022 · 29 comments
Closed

problem after submit #3

carloslencargorges opened this issue Jan 25, 2022 · 29 comments

Comments

@carloslencargorges
Copy link

when I press submit I see this message:
{"result":"error","error":{}}

@levinunnink
Copy link
Owner

Hmm. Can you post example of the HTML code that you're using to submit?

@abdohwebdev
Copy link

abdohwebdev commented Feb 16, 2022

same here

this is the html

<form 
  method="POST" 
  action="https://script.google.com/macros/s/AKfycbw8QzcqXLrg2CjRclFm3s5WVRG7a2uYshRCjyc1JivqWW0mrhM-I8n3mX118yj85fw/exec"
>
  <input name="email" type="email" placeholder="Email" required>
  <button type="submit">Send</button>
</form>

@Christopher-Force
Copy link

Christopher-Force commented Feb 28, 2022

FIXED
The headers for the spreadsheet are case-sensitive with the form name attribute. The headers do not need to be in order, but the name attribute must EXACTLY match with the header.

<input name="email" type="email" placeholder="Email" required> <input name="name" type="text" placeholder="Name" required>

gh

PREVIOUSLY

"Unfortunately, I have this problem as well."

Failed to load resource: the server responded with a status of 404 ()

@levinunnink
Copy link
Owner

Thanks for the update, Christopher. I'll update the documentation to reflect this finding.

@dih-vicenza
Copy link

when I press submit I see this message: {"result":"error","error":{}}

same error here. Someone help me please :(

@Christopher-Force
Copy link

Christopher-Force commented May 25, 2022

when I press submit I see this message: {"result":"error","error":{}}

same error here. Someone help me please :(

Please share your form code and your spreadsheet headers and I'll take a look

@Christopher-Force
Copy link

Hi I had a problem here, I have followed all the tutorial and according to me it should work perfectly but when I click the submit button nothing happens, not even the Google screen comes, just the page is to be seen where i filled up the form and nothing is reflecting in the form.

I have copied the same code which is written here

Screenshot 2022-04-24 at 18 09 09 Screenshot 2022-04-24 at 18 09 17

`<form

  method : "POST"

  action : "https://script.google.com/macros/s/AKfycbwBX_cJC5avaNsdHv-pWAIt0EEHqtAC6XZBxEQWa6OjGutT78umU-NBsZZoMOkHkKYF/exec">
`

If you're still having issues, please send your entire form element with the input elements along with your spreadsheet headers and I'll take a look

@dih-vicenza
Copy link

when I press submit I see this message: {"result":"error","error":{}}

same error here. Someone help me please :(

Please share your form code and your spreadsheet headers and I'll take a look

Ok @Christopher-Force !

The headers are: https://docs.google.com/spreadsheets/d/1NNn8Lxp0nBO7ngCwCJXkGKPT29k1pL2vQ3WK_O4_p5I/edit?usp=sharing

while the form code is:

Send

Thank you!

@Christopher-Force
Copy link

when I press submit I see this message: {"result":"error","error":{}}

same error here. Someone help me please :(

Please share your form code and your spreadsheet headers and I'll take a look

Ok @Christopher-Force !

The headers are: https://docs.google.com/spreadsheets/d/1NNn8Lxp0nBO7ngCwCJXkGKPT29k1pL2vQ3WK_O4_p5I/edit?usp=sharing

while the form code is:

method="POST"

action="https://script.google.com/macros/s/AKfycbys401RD2C4sYkd4U6PYvsmeIqpJko6yNC3luI1F_9eohg5_ROVUTt_sEKHUy2eZ3sXOA/exec"

Send

Thank you!

image

If you don't use this, your code will disappear 🙂

@dih-vicenza
Copy link

dih-vicenza commented May 25, 2022

@Christopher-Force
Copy link

Christopher-Force commented May 25, 2022

sorry @Christopher-Force, I'm a newbie :)

`<form

method="POST"

action="https://script.google.com/macros/s/AKfycbys401RD2C4sYkd4U6PYvsmeIqpJko6yNC3luI1F_9eohg5_ROVUTt_sEKHUy2eZ3sXOA/exec"

Send

`

image

This is an old example of regular html implementation (Not a framework like React)

Each of your name attributes for your <input> elements must match case-sensitive to your headers, disregarding date.

The id attribute on <form> is only if you wish to stop the page from redirecting to a success screen, similar to what you saw for the error. This is explained in the readme as well and requires a script that the creator has kindly written for us.

Let me know if this helps and if you have other questions!

-Chris

@shafeequekp
Copy link

ajax code for not to redirect to another page. means saving from same page not to go next page

@standa006
Copy link

hi a got a same issue
{"result":"error","error":{}}
My form is


<form method="POST" action="https://script.google.com/macros/s/AKfycbw4Odn2kvRBVB_-xrx23l7SjpUrfhhsWgMGZJONjPCEj_fQshsadEKtieUA7sd6FIyc9w/exec">
  <input name="email" type="email" placeholder="email" required>
  <input name="name" type="text" placeholder="name" required>
  <button type="submit">Send</button>
</form>

and header in excel like
image

Could you help me?

@luk1790
Copy link

luk1790 commented Jun 3, 2022

@standa006 Check on code from step2 :
const sheetName = 'Sheet1' this name is the same like on your sheet
image

@ExhausteDD
Copy link

@standa006 Check on code from step2 : const sheetName = 'Sheet1' this name is the same like on your sheet image

I have same problem
Checked name of sheet, even naming sheet like in this example - still have {"result":"error","error":{}}

@ExhausteDD
Copy link

ExhausteDD commented Jun 17, 2022

hi a got a same issue {"result":"error","error":{}} My form is


<form method="POST" action="https://script.google.com/macros/s/AKfycbw4Odn2kvRBVB_-xrx23l7SjpUrfhhsWgMGZJONjPCEj_fQshsadEKtieUA7sd6FIyc9w/exec">
  <input name="email" type="email" placeholder="email" required>
  <input name="name" type="text" placeholder="name" required>
  <button type="submit">Send</button>
</form>

and header in excel like image

Could you help me?

Finaly i found what is the problem.
Here -> https://github.com/levinunnink/html-form-to-google-sheet#3-run-the-initialsetup-function you must set "doPost" instead of "InitialSetup" and it will work
image

@Keshy12
Copy link

Keshy12 commented Jun 26, 2022

If it's still not working for somebody:
Keep in mind that google uses your native language by default. Before doing the first intialSetup change the sheetName accordingly.
image
Mine was "Arkusz1", I had to redo all of the steps with this change but after this it worked like a charm.

@rcuesta00
Copy link

Another mistake that maybe some people could be doing has to do with the Deployments.

Try to test first your deployment: Deploy > Test Deployment

Copy the URL to your HTML code (<form method="POST" action="URL_Test").

After testing, now you can do the Deploy as in the documentation. Otherwise, every time you change something in your script you has to do another deployment.

@ashloren
Copy link

ashloren commented Nov 6, 2022

How can I redirect those who submit the form to a URL on my site?

@Keshy12
Copy link

Keshy12 commented Nov 7, 2022

How can I redirect those who submit the form to a URL on my site?

I'd try using AJAX to send POST request, and then redirect on success with jquery.

@erikantony
Copy link

It works great. How can I set that after form confirmation and sending will be reloaded new blank form? Thank you

@ff1st
Copy link

ff1st commented Feb 16, 2023

Mine worked perfectly well with the doPost. How do I redirect the form to another .html page, please, @Christopher-Force?

@ff1st
Copy link

ff1st commented Feb 16, 2023

How do you do that?

@Christopher-Force
Copy link

Mine worked perfectly well with the doPost. How do I redirect the form to another .html page, please, @Christopher-Force?

Sorry if my answer seems incomplete, in a rush and wanted to see if I could throw out some quick help.

This is a quick piece from an old project.
Written in ReactJS. Maybe use this to give a little guidance.

I imported useNavigate so that I'm able to change which page is routed. Highly recommend asking your questions to ChatGPT as they've already helped me code programs by myself that make my work life easier.
Prevent default stops the redirect, that's regular JS. After sending the data, I use the .then to insert my navigation function. You will have to use a different function if not using react.

import { useNavigate } from "react-router-dom";

const subscribeToNewsLetter = (e) => {
e.preventDefault();
quoteButton.click();

jsonp(`https://outlook.us5.list-manage.com/subscribe/post-json?xxxxx&${queryString.stringify(formValue)}`, { param: 'c' }, (err, data) => {
  console.log('err:', err);
  console.log('data:', data);
}).then(navigate('/thankyou'));

}

@wkpires
Copy link

wkpires commented Mar 7, 2023

Hey guys, I'm trying to do the same test (with external html), but restricting access to the domain and it's not working. With an html inside the google script it works.
image

@ff1st
Copy link

ff1st commented Mar 26, 2023 via email

@tthompson0712
Copy link

Thanks for sharing. I got everything working but I don't like the return page for success. I then have to click the back button to go back to my website and the form is not reset. Is there a way to automatically go back to the webpage after submit and auto reset form?
image
image

@Keshy12
Copy link

Keshy12 commented Apr 20, 2024

Thanks for sharing. I got everything working but I don't like the return page for success. I then have to click the back button to go back to my website and the form is not reset. Is there a way to automatically go back to the webpage after submit and auto reset form? image image

Do it via AJAX, then you won't even need to redirect anywhere at all :)

@ff1st
Copy link

ff1st commented Apr 21, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests