If there is something I "hate" of Web programming with PHP, is the constant mix of HTML with PHP and Javascrip when I have to build a screen.
I start putting the HTML code for the form (text, checkboxes, combos, buttons, etc.). Then I insert the PHP code to set initial values in the fields that -most of the time- come from the DB.
Then I plug all the possible validations I can do on the files using Javascript, such as empty files, numbers, dates, etc.
All this is very repetitive and BORING!
So, in other effort to reduce time programming the same over and over again, I created the class "Form" which:
- Has one method that builds any field you need in your form based on the arguments you pass.
- Sets all the default values for those arguments you don't pass (most of the arguments are optional).
- Builds forms with a uniform look and feel.
- Validates the inputs based on the fields you mark as "mandatory" (argument of the main method).
- Restricts the inputs to numbers if indicated.
This is saving me HOURS of development.
//Put the code here...
Friday, December 5, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment