Learn-to-send-email-via-google-script-html-no-server: NOT WORKS (Prevent the page changing)(Step 10)(Success)(Bootstrap + Jquery)

Created on 22 Jun 2019  Â·  6Comments  Â·  Source: dwyl/learn-to-send-email-via-google-script-html-no-server

I have followed the instructions to the letter, and have returned my steps again and again without finding the error ... Although the console throws the file properly loaded Js, once I press the send button I get the data to the mail and everything buuuut the web page changes and I appear "success".

My form contains the ID "gform" and the div that contains the elements has the class "form-elements". Likewise, the Script is loaded at the end of the body. I really do not know what I'm doing wrong):
It will be because I use bootstrap? or why did I charge the Jquery at the beginning? What do I do wrong?

Form
Script Form
Ubicacion

Most helpful comment

  • Changes marked by <!--FIX-->

All 6 comments

Should have class=gform. I'd recommend using the JS console debugger to see what code is hit, if any, when you first load the page (does it find the form?) or when you hit submit (does it trigger the callback?).

I do not know how to do that, but I'm desperate ... So here's my project:
www.propiedadesarica.tk.zip

It should work now. Changed 2 lines in form-summission-handler.js and some lines in index.js.
In js file there was some wrong catching of elements, and in index I think that problem was making unclosed div and also wrong catching of elements.
Anyway, any changes are marked by .
Btw, I probably also send you a couple of emails while testing.

Cheers :)

www.propiedadesarica.tk.zip

  • Changes marked by <!--FIX-->

It should work now. Changed 2 lines in form-summission-handler.js and some lines in index.js.
In js file there was some wrong catching of elements, and in index I think that problem was making unclosed div and also wrong catching of elements.
Anyway, any changes are marked by .
Btw, I probably also send you a couple of emails while testing.

Cheers :)

www.propiedadesarica.tk.zip

jaja ! Yes friend! I noticed a couple of them, I thought someone had visited the site or that my girlfriend had pressed while I left the room xDD was funny ... I also thought that someone here reviewed it ... Thank you very much for your time! I will take a look!

Well, it works excellent! Thank you so much!

In case someone else happens to me, I hope the following and the above is useful:

I took a look and noticed the following changes:
• The "form-elements" was within the

, but was moved out of it, to a
that contained all.
• Message of thanks [uncommented].
• Send button [enabled]. (I had disabled it)

But the most important changes (I believe) are in the file [form-submission-handler] obtained from here.
• It was replaced in line 84 form.querySelector (". Form-elements") by document.querySelector ("# form-elements").
• It was replaced in line 88 form.querySelector (". Thankyou_message") by document.querySelector (". Thankyou_message").

I think those were the modifications, I hope they are useful to someone else.
Fix form
Fix form submission

If I understood correctly, the problem was the Jquery selector and the position of the form-elements.
Thank you very much to all! I'll close the thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

onurusluca picture onurusluca  Â·  4Comments

JintaYadomi picture JintaYadomi  Â·  3Comments

sidbatra picture sidbatra  Â·  4Comments

jchesner picture jchesner  Â·  3Comments

mckennapsean picture mckennapsean  Â·  3Comments