A little project ive been working on, please critique
Moderator: General Moderators
A little project ive been working on, please critique
This is a little project ive been working on for the last couple days. Maybe if it catches on I'll GPL it. Anyway, I'd like to have some people with experience critique the code and the way its done. Also feel free to contribute code or ideas.
I wanted to create some classes to handle html forms. A good portion of my coding goes into validating forms, getting data from them, setting their values from $_POST, etc. I figured why not create a class to handle all of that.
So far, this is what it does:
-Renders all form objects (XHTML)
-Crude handling of how form objects are displayed on page
-handles $_POST and will use those values if told to do so
What I'd like it to do in the future:
-Client side validation
-Server side validation
Some cool features are:
-Some inputs (right now, text and checkbox inputs) can be defined as multiple and will be created as input arrays.
And what currently needs to be improved/redone:
-layout handling, should use CSS instead of current method
Heres a brief description of how it works:
There are the input objects (input_text, input_select, input_textarea, input_checkbox, input_radio), the fieldset object, and finally the form object. The fieldset object contains a collection of inputs, and the form object contains a collection of fieldsets.
Most of the dirty work is done in the input objects. I used an abstract input class to keep the input objects as uniform as possible, but obviously each input required a lot of its own code because of how values are handled in the different inputs.
The fieldset object is very simple, its primary function is to serve as a nice way of organizing fields.
the form object is also pretty simple, but only because it doesn't implement a lot of the features I hope for it to eventually have.
Heres a zip of the files, make sure they're all in the same directory when you test.
Form Objects
BTW, this code requires PHP 5.
Thanks.
edit: index.php contains the test code. Viewing that first would be a good start.
I wanted to create some classes to handle html forms. A good portion of my coding goes into validating forms, getting data from them, setting their values from $_POST, etc. I figured why not create a class to handle all of that.
So far, this is what it does:
-Renders all form objects (XHTML)
-Crude handling of how form objects are displayed on page
-handles $_POST and will use those values if told to do so
What I'd like it to do in the future:
-Client side validation
-Server side validation
Some cool features are:
-Some inputs (right now, text and checkbox inputs) can be defined as multiple and will be created as input arrays.
And what currently needs to be improved/redone:
-layout handling, should use CSS instead of current method
Heres a brief description of how it works:
There are the input objects (input_text, input_select, input_textarea, input_checkbox, input_radio), the fieldset object, and finally the form object. The fieldset object contains a collection of inputs, and the form object contains a collection of fieldsets.
Most of the dirty work is done in the input objects. I used an abstract input class to keep the input objects as uniform as possible, but obviously each input required a lot of its own code because of how values are handled in the different inputs.
The fieldset object is very simple, its primary function is to serve as a nice way of organizing fields.
the form object is also pretty simple, but only because it doesn't implement a lot of the features I hope for it to eventually have.
Heres a zip of the files, make sure they're all in the same directory when you test.
Form Objects
BTW, this code requires PHP 5.
Thanks.
edit: index.php contains the test code. Viewing that first would be a good start.
I have had only a very brief look at your code so i'm not sure, but i think this: http://pear.php.net/package/HTML_QuickForm is the same as your project (but on steroids
)
but its not written in php 5!!timvw wrote:I have had only a very brief look at your code so i'm not sure, but i think this: http://pear.php.net/package/HTML_QuickForm is the same as your project (but on steroids)
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Might be a problem for client side software, but not the case with PHP. If you were to start writing a php app right now, don't you think it would make more sense to write it in PHP5, since eventually it will be the standard?Maugrim_The_Reaper wrote: j/k, php5 IS more flexible, but there's little advantage to using it's full potential until it's standard...
- smpdawg
- Forum Contributor
- Posts: 292
- Joined: Thu Jan 27, 2005 3:10 pm
- Location: Houston, TX
- Contact:
bgzee - I downloaded the zip and took a look at it. It looks good, clean and easy to read. I think you need to start over.
Seriously though, are you going to continue working on it or jump ship to Prado? I have to admit that I started looking at Prado a few months ago and it is impressive.
The reason I have stuck with my own framework is:
1. I started it over a year ago and I have a lot of time invested in it.
2. I have a different goal for my project.
Seriously though, are you going to continue working on it or jump ship to Prado? I have to admit that I started looking at Prado a few months ago and it is impressive.
The reason I have stuck with my own framework is:
1. I started it over a year ago and I have a lot of time invested in it.
2. I have a different goal for my project.