dwyl / learn-to-send-email-via-google-script-html-no-server

:email: An Example of using an HTML form (e.g: "Contact Us" on a website) to send Email without a Backend Server (using a Google Script) perfect for static websites that need to collect data.
GNU General Public License v2.0
3.12k stars 910 forks source link

Thank you page #19

Closed chemopetrol closed 7 years ago

chemopetrol commented 8 years ago

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

Min11Benja commented 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?

mckennapsean commented 7 years ago

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).

omartan commented 7 years ago

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>
mckennapsean commented 7 years ago

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!

omartan commented 7 years ago

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?

mckennapsean commented 7 years ago

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!).

omartan commented 7 years ago

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"]}
mckennapsean commented 7 years ago

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!

omartan commented 7 years ago

Hi, okay. I looked into my code and found out 2 areas probably should be mentioned in the guide:

  1. That the form name= must match with the code given.
<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>
  1. If the <form id = "gform"> isn't the same as guide, the user is required to open form-submission-handler.jsand change the 3 instances of gform to their chosen ID
mckennapsean commented 7 years ago

Thanks for finding both of those! Could you submit an issue on one or both of these?

omartan commented 7 years ago

Submitted an issue, I'm new to GitHub so I hope my post is correct

mckennapsean commented 7 years ago

Thanks so much, @wheelhot - looks great!

jchesner commented 3 years ago

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">

Activity Proposal Submission Form




PROPOSAL FORM - PHARMACY
AchieveCE is always looking for CPE activity proposals that meet various state-required continuing education needs and allows pharmacy professionals to grow in their profession. Whether it is a webinar or a monograph, we are looking for CPE activities about a variety of topics and depths that can help both pharmacy and pharmacy technicians be the best at what they do.

AchieveCE accepts and evaluates proposals throughout the year. Proposals reviewed are evaluated based on the following criteria:

  • Quality of proposal
  • Clearly defined topic focus and objectives
  • Practical application of materials proposed
  • Relevance to modern practice
  • Previous experience in presenting and writing CPE activities
  • Compliance to ACPE standards for CPE
All proposals for CPE activities must be original and unpublished.

AchieveCE has also selected a number of topics that address the identified needs of pharmacy professionals in the country. Activity proposals should be designed to meet these topics.

If the topic you wish to write about or present is not included in our list of selected topics, you may still submit a proposal, provided that an evidence of the need for the topic is included in your submission AND that you have subject matter expertise in the topic you wish to write about. A subject matter expertise is one who practices in the area related to the topic and one who meets the following criteria:

  • Certification in the subject matter by the Board of Pharmacy Specialties or similar
  • Leadership position at the local, state, or national level
  • Publication in a peer-reviewed journal or study presentation to a state-wide or national audience
  • High regard of professional peers
Please complete the online activity proposal form after you have reviewed the information above. You may contact Gracielle Tubera with any concerns and questions about your proposal submission.






  Live Webinar        Home Study Monograph





  Yes        No


  Knowledge-Based
These activities are primarily constructed to transmit knowledge. The facts must be based on evidence as accepted in the literature by the health care professions.
  Application-Based
These activities are primarily constructed to apply the information learned in the time frame allotted. The information must be based on evidence as accepted in the literature by the health care professions.

  Level 1: Recall
This activity requires only a surface understanding of data presented and often consists of verbatim recall from data or simple understanding of a single word or phrase. Participants are required to recall information such as a fact, definition, or term.
  Level 2: Basic Application of Skills & Concepts
This activity includes the engagement of some mental processing beyond recalling a response. Participants are required to make observations of data through classification, tables, graphs, and charts
  Level 3: Strategic Thinking & Reasoning
This activity requires proving understanding of data with reasoning and planning. Participants are required to draw conclusions from observations, citing evidence, and understanding various concepts used to solve problems.
  Select all that apply.
  Pharmacists
  Pharmacy Technicians

  Yes
  No
  Does Not Apply
  Select all that apply.
  Concentrated Focus
  Health System
  Retail
  Pharmaceutical Industry
  Other/Non-Patient Interaction
  Select all that apply.
  Administration

  Home Health Care

  Nuclear

  Specialty
  Ambulatory Care

  Home Infusion

  Oncology

  Veterinary
  Biotechnology

  Inpatient

  Other

  Clinical

  Long-Term Care

  Outpatient

  Compounding

  Mail Service

  Poison Control

  Consultant

  Managed Care

  Research







  Yes        No




`