0

This contact form has Sendgrid and heroku in place, fully working. Github repo here

I trying to find a way to get the value of all the form elements.

Then make them into a param and then post it all to the endpoint using axios.

I do I connect my Heroku form using axios?

I'm quite lost on this process, and I need some. directions here. Perhaps a hint.

JS

axios.post(/mails/users/sendVerificationMail, body, { params: { mail, firstname }}) .then(response => response.status) .catch(err => console.warn(err));

HTML

<form id="contact-form">
  <div class="row required">
    <label for="name">Name</label>
    <input class="input" id="name" type="text" name="name" autocomplete="name" required>
  </div>
  <div class="row required">
    <label for="surname">Surname</label>
    <input class="input" id="surname" type="text" name="surname" autocomplete="surname" required>
  </div>
  <div class="row required">
    <label for="email">Email</label>
    <input class="input" id="email" type="email" name="email" autocapitalize="off" autocomplete="email" required>
  </div>
  <div class="row">
    <label for="phone">Phone</label>
    <input class="input" id="phone" type="text" name="phone" autocomplete="tel">
  </div>
  <div class="row">
    <label for="role">Job Role</label>
    <input class="input" id="role" type="text" name="role">
  </div>
  <div class="row">
    <label for="message">Message</label>
    <textarea class="textarea" id="message" name="message"></textarea>
  </div>
  <div class="buttons row">
    <button class="btn primary" type="submit">Submit</button>
  </div>
</form>
user173420
  • 376
  • 1
  • 16
  • Does this answer your question? [FormData created from an existing form seems empty when I log it](https://stackoverflow.com/questions/25040479/formdata-created-from-an-existing-form-seems-empty-when-i-log-it) – Cfreak Sep 23 '20 at 13:23
  • See here: https://thoughtbot.com/blog/ridiculously-simple-ajax-uploads-with-formdata – AbsoluteBeginner Sep 23 '20 at 15:50
  • @AbsoluteBeginner are you able to direct me? I don't see the way to integrate heroku with that – user173420 Sep 23 '20 at 16:33

0 Answers0