Open rufuspollock opened 1 year ago
@khalilcodes can we get a separate "sign up for updates" form - and can we document somewhere how these forms get created so i can do this myself in the future?
@rufuspollock here are some notes ...
Using fetch: It is possible to submit a form and create a contact in Brevo successfully using a fetch request but this has two main issues ..
mode: no-cors
which is a no no for security.Using form's action:
Doing <form method="POST" action="...">
with correct input prop values (id + name) being same as in Brevo's generated html are enough for the form to submit succesfully. After submission, we are redirected to a Brevo generated confirmation page. As seen in the settings this can be a custom page from our site (eg. pages/thank-you-for-signuo).
. The above page is also shown even on submissions of already subscribed users, which is ok imo.
My 2c is that the second option is the goto method if we want custom, simpler and least amount of jsx. In this case the code would just be ...
<form method-"POST" action="...">
<input id="EMAIL" name="EMAIL" ... />
<button type="submit">...</button>
</form>
The only reason for using Brevo's html and script tag (current setup) was to not redirect the user to another page after the form submits. If that's not a concern then I think we can replace.
@khalilcodes great summary and agree with going with option 2.
When i read a blog post I want to sign up to get regular updates so that I hear about future developments
When I read a blog post I want to see an offer for a free course so that I sign up and get the course and are kept informed of future developments
Acceptance
Notes
Discussion 2023-05-04
We want to use simple html forms ...