I have come across quite the problem when making my own framework. I have found some other questions that come close to what I'm asking, but not quite.
This is what I am attempting:
- Page has a form with method post and submits to itself (same page).
- When you submit, the input is validated appropriate messages / errors are displayed.
It seems simple, but I am trying to:
- Avoid form resubmission that comes with using post. This wouldn't be a problem if I also wasn't trying to...
- Avoid having duplication or more code than needed. Redirection adds an extra action where I would need to check the input twice (once on the submit page for validation and once on the redirected page for messages/ errors).
- Avoid using query strings, cookies or sessions. Which makes the solution of posting to another page and then redirecting while still having message handling impossible (as far as I know).
- Avoid relying on AJAX since JS can be disabled.
Am I asking too much or is there a way to do this? Is there something I would need to compromise on to achieve this? If not, then I guess I will go with sessions and redirection.