Plug-in or API for forms?

I want to create a website with only vscode and upload my files/folders to my hosting site via SMTP. Trying to do one project old school like 🤣 However I’m not sure how to handle form validation and notifications and storage. Is there a way to import a tool that can handle forms for me? Im intentionally not using Wordpress or other platforms for this project. I was going to use a webhook to push the form data to googleSheets but I don’t know if I’ll need further form validation then what is baked into the html attributes. I’m not totally sure I’m using the correct language by calling the tool I need an API or plug-in btw.
4 Replies
Jochem
Jochem•11mo ago
you can never trust frontend validation without a backend to run validation on, you'll never be sure someone didn't just manipulate the webhook request to google sheets in the devtools. that said, you can hook into the submit event on the form and run whatever javascript you want. There's zod, which is a popular validation tool.You can also just write your own validation code, it's usually not much more than a couple of length checks and whether an email address field has an @ in it also, I really really doubt you mean SMTP, the Simple Mail Transfer Protocol. You probably mean FTP? also just as a bit of housekeeping, this is more of a #front-end question. It doesn't really matter what editor you use.
clevermissfox
clevermissfox•11mo ago
Haha yes FTP thank you , I should not be posting so late at night. I think I was going for SFTP. Where would I put my own validation code? Thank you for suggestion Zod too I’ll look into that. I think I have a good idea how to define parameters for form validation but not sure where to put it other than inline on the form elements.
Jochem
Jochem•11mo ago
you'd probably put it in an event listener on the submit event, or individually on the fields in change event listeners. I wouldn't put them inline though, it's not a good idea to use the onsubmit or onchange properties on the HTML elements. Load a script that adds event listeners instead
clevermissfox
clevermissfox•11mo ago
gotcha, i didnt realize te validation would be javascript functions but that makes sense. thank you so much.
Want results from more Discord servers?
Add your server