Abstract Form Handling
I've already gone over some basic form handling and form best practices with my last few posts, but building with an object-orientated MVC starts to throw forms into a different light. It's very easy to abstract out forms with their repetitive logic patterns, something that I've recently done on one of my side projects. While I don't want to explain the code line-by-line, this post will go over some of the basic thought processes and steps I took to make my abstracted form handler.
Form Wrapper
The first logic I worked out was the definition of a form. To create each new form, I create a new class that is abstracting off a base pattern. Each form class defines form elements within a standard 'get' method. This way I can call on individual form elements easily or call the entire class to pull the whole form. Example...
read more »