Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I use this solution in React? #411

Closed
chwonseok opened this issue Oct 1, 2021 · 1 comment
Closed

How can I use this solution in React? #411

chwonseok opened this issue Oct 1, 2021 · 1 comment

Comments

@chwonseok
Copy link

Hey there, first of all, thanks for this nice solution what I've been looking for!

I'm currently stuck with one minor issue though.
The issue is that it doesn't print thankyou_message after the mail has been successfully sent, which means I see {"result": "success", ...} only.

In public folder, I attached form-submission-handler.js, and the place where I added <script>tag is in the index.html in public folder, like below.

<body>
  <div id="root"></div>
  <script data-cfasync="false" src="%PUBLIC_URL%/form-submission-handler.js"></script>
</body>

If it is not the way or place to use this solution in JSX, could you please let me know?

Thanks in advance!

@bledatunay
Copy link

bledatunay commented Oct 25, 2021

Not sure what exactly you are actually asking, and what this has to do with React, but I'll try to answer anyways.

Here, thankyou_message is not something to be printed, it is just a CSS id to be given to a div.

<div style="display:none;" id="thankyou_message">
Your message here
</div>

When styled properly, form-submission-handler.js will find the div above by its id and show it with the line below.

document.getElementById("thankyou_message").style.display = "block";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants