space10-community / conversational-form

Turning web forms into conversations
https://space10-community.github.io/conversational-form/
MIT License
3.8k stars 776 forks source link

How to submit data and send to email? #354

Closed mattsafaii closed 4 years ago

mattsafaii commented 5 years ago

I am trying to use this on a Bulma site.

I have this in my tag: <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/space10-community/conversational-form@1.0.1/dist/conversational-form.min.js" crossorigin></script>

And my HTML looks like this:

    <form id="my-form-element" cf-form>
        <input type="text" cf-questions="What is your first name?" id="firstname" />
        <input type="text" cf-questions="What is your last name?" id="lastname" />
        <input type="text" cf-questions="It's nice to meet you, {firstname} {lastname}. What's the best email to reach you at?" />
      </form>
      <div id="cf-context" role="cf-context" cf-context></div>

How can I get the form to submit and send the data to an email address?

jenssogaard commented 4 years ago

Hi @mattmaker. This one of the more common questions. We cover the "submitting data"-part, sending the email happens serverside and is your own responsibility. You either do a traditional form submit or you do an AJAX request.

You can use formspree as your endpoint and data collector/send email service.

Once you have setup your formspree account you just need to add action and method attribute to your form tag.