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

Implement domain validation for client-side input ✅ #19

Open
JamieSlome opened this issue Feb 11, 2024 · 4 comments
Open

Implement domain validation for client-side input ✅ #19

JamieSlome opened this issue Feb 11, 2024 · 4 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@JamieSlome
Copy link
Collaborator

Reproduce the issue ⚡️

Enter the value "ghost" into the input box. On form submission the request is subsequently processed and fails as this is not a legitimate domain.

Photographic evidence 📷

Screenshot 2024-02-11 at 21 22 48

Suggested improvements 🔨

Implement client-side logic to validate the input and prevent form submission if the input does not take the form of a legitimate domain. This is most likely to take the form of a Regular Expression that validates the input and enables form submission once satisfied.

Subsequently, this will leave the error message for domain forms that most likely aren't actually live or legitimate domain requests:

Screenshot 2024-02-11 at 21 27 11
@JamieSlome JamieSlome added good first issue Good for newcomers bug Something isn't working labels Feb 11, 2024
@Sal-ter
Copy link

Sal-ter commented Feb 12, 2024

Happy to take this on!

@JamieSlome
Copy link
Collaborator Author

@Sal-ter - awesome 👍

@moshetanzer
Copy link
Contributor

moshetanzer commented Feb 13, 2024

Hi,

All that is needed is type=url. But think @danielroe wanted to do it in on ss and show domain not found error.

@JamieSlome don't think this is a bug. Think Daniel put type text on purpose just like on pagespeed.web.dev - to make client side not to restrictive.

@JamieSlome
Copy link
Collaborator Author

JamieSlome commented Feb 13, 2024

Thanks for the feedback @moshetanzer 🤝

Generally speaking, I've always thought it is good practice to have client-side and server-side validation. It also doesn't make too much sense submitting a non-domain input if the server can only work with a valid domain input. I guess it is a matter of preference; if the server side is light it doesn't make much of a difference.

@danielroe - thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants