bunder5 Posted October 13, 2011 Share Posted October 13, 2011 Is it worthwhile to create an object to generate my HTML forms? Starting out it would appear to be worthwhile but I'm not sure how things might change later down the line when I'm doing more with my forms and introducing javascript to it. It's a bunch of coding to change all my forms now so I wanted to hear some input before I started. Would this be just a complete waste of server side processing? TIA! Quote Link to comment Share on other sites More sharing options...
jcbones Posted October 13, 2011 Share Posted October 13, 2011 It all depends on your needs. I created a class that handles input's (not the whole form), then I have a validation class that automatically validates the inputs. This takes loads of work off of me, as I only need to set the validation rules for the inputs. It is also written in a way that I can add any javascript that I need as well. The question isn't "is is worthwhile", the question is "can you make it open ended enough". Quote Link to comment Share on other sites More sharing options...
TOA Posted October 13, 2011 Share Posted October 13, 2011 IMO, don't re-invent the wheel if you don't have to. There's been a few written, just do a google search, I ran across one just the other day. Can't remember where or I'd tell you. Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted October 14, 2011 Share Posted October 14, 2011 As DevilsAdvocate said there's plenty already out there, or as jcbones mentioned you could create your own. Just a matter of preference really and "is is worthwhile" Personally I prefer to just to type up forms myself, and keep the validation separate. Quote Link to comment Share on other sites More sharing options...
bunder5 Posted October 18, 2011 Author Share Posted October 18, 2011 Thanks for all the replies, I've been writing something for myself so it suits my needs and also for the learning. All my class variables are private. I am only letting values be set through the constructor, am I okay to not create accessor functions? private $css_class; // css style for the form (defaults to "user_form") private $action; // where form is submitted to private $legend; // legend text value (defaults to blank string) private $method; // method (defaults to post) private $html; // html code for the form Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.