Closed chemopetrol closed 7 years ago
Im having the same problem. I added the div with the thank you code onto the html index page, but even though it does send the email with some fields not all of my form. (only time name and email, comment and hidden fields for UTM won't show up) and It updates those fields on the excel sheet, I have a costume thank you page that i wanted to redirect them to once they filled out the form. I tried adding this line of code to redirect them "window.location.href = "thankyoupage.html";" to the JS AJAX file which I copied and placed in my js folder as form.js but i still get no thank you message. Can someone please help me?
For Ben, the Thank you page is simply a hidden div. When a request is sent to the Google Apps script, then it will both hide the current form div and display the hidden thank you div. You can just copy the code here (and line 53) to see if these calls work through your browser's console. It may have issues with old versions of browsers which do not support these selectors (but the function to get data from your form would likely be breaking too). https://github.com/dwyl/html-form-send-email-via-google-script-without-server/blob/master/form-submission-handler.js#L52
For @Min11Benja , you could be having similar issues. You could try those commands to see if the div's do get hidden or displayed correctly, ignoring the form's functionality. It may be that you have an unsupported browser. The command to send to a new page should also work, so maybe you are not getting to where these commands are supposed to get called in the code (when the data gets sent to the Google Apps script).
Hmm, so based on Step 10, when I click on submit, it should show a thank you message and not the contents of my mail?
I just tried it in Safari and Chrome but it doesn't work.
<form action="https://script.google.com/macros/s/......" method="post" id="address" class="col-xs-9 offset">
<div class="row row1">
<div class="col-xs-6">
<label class="sr-only" for="name">Name</label>
<input type="text" class="form-control" id="name" placeholder="Name" name="user_name" required />
</div>
<div class="col-xs-6">
<label class="sr-only" for="email">Email address</label>
<input type="email" class="form-control" id="email" placeholder="Email" name="user_email" required />
</div>
</div>
<div class="row row2">
<div id="text-message" class="textareaWrapper col-xs-12">
<textarea placeholder="Your enquiry" id="message" class="form-control" rows="3" name="user_message" required /></textarea>
</div>
</div>
<div id = "submit">
reCAPTCHA
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
.
.
.
.
.
<script data-cfasync="false" type="text/javascript" src="https://cdn.rawgit.com/dwyl/html-form-send-email-via-google-script-without-server/master/form-submission-handler.js"></script>
</body>
So this does not seem related to the issue above. It also looks like you are calling the Javascript code hosted on GitHub, which has certain IDs it expects to run, such as gform
for your form and various other ones. If these are not identical to the example, then you should load your own Javascript file rather than using the one online.
Due to lack of response / clear direction forward with this issue, I am closing it for now. Feel free to reopen if it is relevant to the original issue, or file it appropriately. Thanks!
Oh, so you're the one that used the form to mail me? Then yes I did receive the email but doesn't Step 10 result was supposed to be a "Thank You" page once I click on submit?
As I stated, you have an issue with your ID's not matching what the Javascript you source. If you open up a developer tools console in any browser, it will tell you what line there is an error on and why. I fixed the issue and was able to submit the form only then, but I think there are a few more things you have to fix to get the whole thank-you page working as well! I would focus on getting the data submitting first, though (as not getting a user's data is a major problem!).
The form as it's now (I just removed my form action URL) worked (data is submitted, I did receive your email submit). I only have issue on the part where upon clicking submit, it doesn't give the, message sent successful.
{"user_email":["someone@place.com"],"user_name":["test"],"user_message":["Is
this
working? -SM"]}
I would advise looking for help resources on sites such as StackOverflow, as this seems to be a web development issue, not an issue with the repository or code provided. If you can pinpoint a particular step or piece of code that tripped you up or was confusing, feel free to post an issue about it so we can improve the materials here. Good luck on your form!
Hi, okay. I looked into my code and found out 2 areas probably should be mentioned in the guide:
<input id="name" name="name" placeholder="Name" required />
<input id="email" name="email" type="email" value="" placeholder="E-Mail" required/>
<textarea id="message" name="message" rows="10" placeholder="Comments" required></textarea>
<form id = "gform">
isn't the same as guide, the user is required to open form-submission-handler.js
and change the 3 instances of gform
to their chosen ID Thanks for finding both of those! Could you submit an issue on one or both of these?
Submitted an issue, I'm new to GitHub so I hope my post is correct
Thanks so much, @wheelhot - looks great!
I am having the same issue with my thank you page not appearing. Any help would be appreciated!
https://achievece.com/wp-content/uploads/2020/12/proposal_pharm.html
` <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Dear, I´d like to say thank you. Everything works except Thanky you page. I have still result page. My opinion is, that is something missing script.gs (I have ther only doPost, setup and record_data), handleResponse is missing. Thank you for your answer. Ben