teacherfund / TeacherFund_next

A website to fund teachers discretionary spending because the government sucks at it
https://theteacherfund.com
MIT License
90 stars 87 forks source link

Email list form needs better validation #89

Closed ghost closed 5 years ago

ghost commented 5 years ago

The subscribe method in index.js does not have any validation for the inputs. Right now it is assuming there will be a first and last name typed into one input, i feel like that could cause some issues for us and we might want to change how that works (open to discuss).

The email definitely needs a regex validation before submit so that would be the first definite task.

vanessanaja commented 5 years ago

I'd love to work on the email regex validation. This would be my first official issue. I was working on making the page responsive but it turns out that someone was already working on that.

ghost commented 5 years ago

@vanessanaja cool! all you. Go ahead and start working on the email validation. Don't worry about the name for now.

vanessanaja commented 5 years ago

I'll get started on it this afternoon :)

ghost commented 5 years ago

As far as name validation on that form I'm proposing something simple like [a-zA-Z]{2,} instead of checking if it is empty.

stripedpajamas commented 5 years ago

For the email input we should be able to set type=email and mark the input as required and HTML will take care of the validation for us

stripedpajamas commented 5 years ago

As far as the name input goes -- let's definitely split it up to first name last name. Would not want a too restrictive regex on it (some names have apostrophes etc) so would probably leave that one pretty permissive.

vanessanaja commented 5 years ago

I've submitted a pull request for the email validation. I'm happy to work on splitting the name input over the weekend if there's no rush on it.

vanessanaja commented 5 years ago

I've submitted the PR for splitting the name input into first and last name.