Thoughts on extending Smarty to handle .NET style form validation

From: Date: Wed, 03 Apr 2002 19:40:02 +0000
Subject: Thoughts on extending Smarty to handle .NET style form validation
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3472@lists.php.net to get a copy of this message
A friend of mine is experimenting with ,NET at the moment (I haven't had a chance to try it) and has been enthusing about .NET's form validation controls. Apparently when writing a page in ASP.NET you can drop in a single line of code which describes a text box input + associated validation rules. The .NET architecture will then... * Render the HTML for the form element * Add a javascript validation control to check (client side) the validity of the data * Add a server side validation control to double check data as it come in, and if there is a problem... ... re-display the form with a custom error message at the top, all previous form information filled in and some kind of alert next to the element containing the invalid data I should stress that I have not seen this system and I am describing it second hand, but it sounds fantastic - I (and other PHP developers I am sure) spend a large proportion of my time coding the same validation features over and over again, and a one-line client AND server side validation solution would be fantastic. Anyway - it would seem that Smarty is /almost/ the ideal framework for this kind of code. I am planning a set of Smarty custom tags (along the lines of the html_select one) to implement the functionality described above, or at least as close to it as I can get. I say "almost" because the system described above needs to be able to intercept form data once it has been "posted" in order to apply the server side validation, and this does not fall within Smarty's realm of influence. I say I am planning these tags, but at the moment they are more a set of ideas floating around in my head. I am throwing this open to the Smarty list in the hope that people can help me flesh out the ideas and help me produce something that would be of real use to the Smarty community (I doubt my form validation system would end up added to Smarty as the validation aspects would have to be implemented outside the template layer, but I'd to release the eventual system as a complement to Smarty). In particular I am interested in ideas as to how to implement the server side validation in an elegant way (at the moment I am thinking of having a validation "object" which recieves the contents of the $_GET or $_POST arrays). Thanks, Simon Willison simon@incutio.com

« previous php.smarty.general (#3472) next »