dbo Posted July 19, 2007 Share Posted July 19, 2007 Ever get annoyed spending 90% of your time validating user input before processing/inserting into a database? I know I do. I was thinking of trying to write some framework that makes this process more generic and reusable. I'd also like to be able to share the same validation rules with javascript so that I don't have to write the logic twice. I was thinking define some sort of XML document with my validation rules and share that between PHP & Javascript but I see some limitations there as well. So my questions to you, fellow PHPers, do you see merit in this idea? Is it reinventing the wheel... what might be some existing solutions or frameworks that would be worth looking into? Thanks, -Derek Quote Link to comment Share on other sites More sharing options...
dbo Posted July 19, 2007 Author Share Posted July 19, 2007 Bump... you guys have to have an opinion on this! This is surely something that haunts more than just me! Quote Link to comment Share on other sites More sharing options...
predator12341 Posted July 19, 2007 Share Posted July 19, 2007 hmm dont sound like a bad idea. however the large majority of peeps alrewady have there own error classes (well i no i do) so i dont no how effective it will be. Regards Mark Quote Link to comment Share on other sites More sharing options...
dbo Posted July 19, 2007 Author Share Posted July 19, 2007 Oh I'm not doing it to try and sell or make money off of. Not the framework at least. It's just part of a larger project and I want something to be robust to make my life easy so like I could say. //THIS IS A GENERIC EXAMPLE... if( isset($_POST['button1']) ) { $field1 = $_POST['field1']; $field2 = $_POST['field3']; $field3 = $_POST['field4']; $arr = Array($field1, $field2, $field3); $is_valid = validate($arr, "form.xml"); } and then on down the page i could say. generate_javascript_validation("form.xml"); or something to that affect. Quote Link to comment Share on other sites More sharing options...
dbo Posted July 19, 2007 Author Share Posted July 19, 2007 My approach works fine for "normal" cases, but if I have a situation where lets say a delivery date has to happen between 2 weeks of a start date I've got to know that start date before I can do the validation. This can't be a hard coded value in an XML file. Any thoughts... alternative approaches? Quote Link to comment Share on other sites More sharing options...
dbo Posted July 19, 2007 Author Share Posted July 19, 2007 Well, anyone have any love for me or should I actually start to do my real work now? Quote Link to comment Share on other sites More sharing options...
dbo Posted July 20, 2007 Author Share Posted July 20, 2007 Bump... one last try. 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.