Learn-to-send-email-via-google-script-html-no-server: success sent, but there is no received data.

Created on 25 Feb 2020  ·  4Comments  ·  Source: dwyl/learn-to-send-email-via-google-script-html-no-server

Hello, I'm trying to use this one, but I have an issue.

It works fine, and I received the email, but there is no data.
When I submit the form, it said, {"result":"success", "data":{}}.

I tried with

, but also same result.

Am I missing something?

<form method='POST' class='gform contact-us' action='https://script.google.com/macros/s/AKfycbxNNo4Q2P2NWOU2xwFYqkoTwC~~'>
    <div class='about-user'>

    <div>
    <input type='text' class='userInfo' id='userName' placeholder='Name' required />
    </div>

    <div>
    <input type='text' class='userInfo' id='userEmail' placeholder='Email' required/>
    </div>

    <div>
    <input type='text' class='userInfo' id='userMsgTitle' placeholder='Title' required/>
    </div>

    </div>

    <div class='user-message'>
    <textarea class='userMessage' id='userMessage' placeholder='Message' required></textarea>
    </div>


    <input type='submit' class='send' value='보내기'/>

</form>                 

Thank you for your help.

Most helpful comment

the name attribute on all of the form elements. These are necessary for HTML forms to send their data to a server

@mckennapsean THANKS!!! <3

All 4 comments

Where are you following the readme? Your example had “id=gform” which is a sign you’re using an older version of the code. It should be the class.

@mckennapsean I already tried with class. Id and class both out same result.

Class is right; the form is simply missing the name attribute on all of the form elements. These are necessary for HTML forms to send their data to a server (the name is used for stringifying/sending the response). In your example, you could simply swap replace id='*'with name='*'(though if you need those IDs for CSS or something, then add a new attribute). Hope that helps!

https://stackoverflow.com/questions/1397592/difference-between-id-and-name-attributes-in-html

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname

the name attribute on all of the form elements. These are necessary for HTML forms to send their data to a server

@mckennapsean THANKS!!! <3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Herbert2122 picture Herbert2122  ·  4Comments

JintaYadomi picture JintaYadomi  ·  3Comments

Brothman picture Brothman  ·  3Comments

mckennapsean picture mckennapsean  ·  3Comments

vlknlvnt picture vlknlvnt  ·  4Comments