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

Added a React version of index.js and form-submission-handler.js #453

Open
wants to merge 39 commits into
base: add-clasp
Choose a base branch
from

Conversation

autumn-lindberg
Copy link

Hi there!

This is an amazing project and I'd love to do some work on it if you'd allow me.

Here is a basic implementation of how your project could be implemented into a React component.
No dependencies, validation is using regex. Submit button is disabled until input passes regex validation. Only one input is used, but the basic idea is there. I know this isn't the right branch to post it on, but I'd love to know your thoughts!

Please accept my humble PR ❤️

mckennapsean and others added 30 commits February 18, 2019 18:59
Add a GDPR note at the top of the README, addresses dwyl#217
Reset the web form on successful submission, fixes dwyl#283
The HTML 5 form input type of email already handles
email validation. There are cases that are allowed by
HTML5 (e.g., "a@a") which our form used to detect
and notify the user. Since these are less likely to
happen, and the logic is still not fool-proof, simplify
the code and assumptions made therein to be
more generalizable and thus more robust. This is
supported in all modern browsers, and I tested
this also in Edge to verify that it works there, too.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email
Remove unnecessary steps in the readme by including
honeypot spam prevention by default in the script.
Works just fine if no honeypot field is present, since
the falsey or empty behavior also means the form is
submitted. This just makes it easier for users to take
our example and get this feature for free rather than
needing to go through steps and having commented
out code in our sample script. Also fixes a bug since
filtering out the honeypot meant that the honeypot
data was no longer being used and was thus broken.
Remove unnecessary form validation for email
Fixes dwyl#321 by adding honeypot spam prevention
The `validateHuman` function is coded inside `handleFormSubmit` on line 61, so it's not necessary (and not used).
Fix IE with JS since object keys must be defined but only in IE
* Ensure XHR success before clearing the form

Thanks to @tarasyarema for discovering the fix for this.
Originally pulled from PR dwyl#315. Makes sure that the
XHR request is completed and successful before clearing
and hiding the form.

* Remove extraneous console logging

Cleans up console output. Manual logging can
be added by users themselves as desired.

* Remove old honeypot function (dead code)

Removed as part of another PR, but I forgot to
remove the unused function. It just checks if there
is a value and returns the result of that if statement,
with unnecessary logging, so clean that all up.
Make it more natural
Delete English part
Add translation link
Spanish -> Español
Add translation link
Add language-change part in the README files
The attribute name in the JS did not match what the google script was looking for.
Co-authored-by: Ines Teles Correia <[email protected]>
* Add-FAQ-to-README

* Address Sean's code review feedback for FAQ (dwyl#344)

Co-authored-by: athenaozanich <[email protected]>
Google Apps Script released a new version of the web IDE, and these changes are what is needed to get the steps up to date for the latest editor.
Update Apps Script editor images & steps (fixes dwyl#393)
@mckennapsean
Copy link
Collaborator

thanks for the contribution & getting a working example going with React!

over the years, folks have been quite curious about React (#213, #308, #336, #411) and other frameworks (#254). Clearly, you are among good company :)

what I might suggest:

  • separate branch just for a react-demo, or some other code hosted solution (gist, codepen, etc.) -- this could be on a fork of the repo too, if you'd rather maintain it personally.
  • add a link on the main repo (maybe in a new Q&A at the bottom?) to the main trunk

does that seem do-able? do you have a preference on where to store the react example?

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

Successfully merging this pull request may close these issues.

None yet

7 participants