Just a brief best-practices question: what is the best way to do required field checking for a form? I see 3 choices:
- Server side. reload the page with an error message.
- Javascript (Client-side) for user-friendly non-reloading, also duplicate requirements on server side and sanitize input.
- AJAX - best of both worlds, use JS to ask the server if the required field is met.
I guess there is no good definition of what I mean by "best." I would like to know what is optimal, elegant, maintainable, secure, and reliable. Also user experience is key. I'm willing to assume the user does not have JS turned off. The back-end could be anything but I am thinking in PHP.