3 ms·
JavaScript free alternatives to HTML forms?
Are there any?
I'm writing a web app using static html. I need to get not too complex input data like text fields and numbers.
I plan to use HTML forms to have the web page talk to the API layer and do post redirect get pattern, but should I use an alternative technology like XForms? I have never heard of it in use in my circles but figured I should ask.
No js because I want to build my app for the Firefox first, noscript folks and let any JS be just decorative / an alternative front end later on down the road.
Back end is sqlite, web tech is asp.net
Whatever your input is, I want to hear it....thanks for reading.
- gregjor 6y agoHTML forms submit to whatever URL you put in the “action” attribute, which could be an API endpoint, or code in the same file (a common ASP/PHP pattern), or another file. You don’t need JS for that. Likewise a redirect is just an HTTP “Location” header sent to the browser, no JS needed for that, either.
- Ayesh 6y agoI'm convinced a lot of the JS form validation can now be removed in favor of HTML5 form element attribute. You can just set the form action URL to your asp endpoint, which will validate data again, and show the post form on errors, or 302 redirect to the target/form if valid.
- Multicomp 6y agoYeah this was the plan for me, I just wanted to make sure that I wasn't doing something in the old boring way when I should do it in the new fun way.