Re: [SMARTY] SmartyValidate Javascript?

From: Date: Tue, 10 May 2005 17:15:13 +0000
Subject: Re: [SMARTY] SmartyValidate Javascript?
References: 1 2 3 4  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12605@lists.php.net to get a copy of this message
On 10 May 2005, at 14:04, Vicente Werner wrote:
Why duplicate work? Provide the safest and more trouble - free system, and you'll be happy.
From a customer point of view, client side validation is very much in line with creating a trouble-free system.
Can't agree here: it's just better for the client in case it uses a browser that works ok with your javascript code, all the rest might end with strange behaviours or without validation.
I'm not even going to begin to suggest that it attempts to work in all browsers. Even in these enlightened Firefox times, IE6 still counts for ~90% of traffic. If I had client-side validation that ONLY ran in IE6, it would serve the vast majority of clients well, with no impact on javascript compatibility elsewhere. Everyone else can fall back to server-side validation. Further compatibility can wait. Having said that, it's not as if validation requires cutting edge DHTML that's likely to break that badly.
Of course, most of em rely on the fact that you don't want to duplicate your work,
I disagree - they insist that you do duplicate your work if you want both client and server side validation.
and on the other side, how're you going to send the server side rules to your client? You'll need a bridge to fill the gap.
That's not hard - if a smarty plugin can generate appropriate template content and messages for validation on the server side, then it can also generate Javascript to do the same thing on the client side. Put it like this - SmartyValidate is a set of Smarty plugins to add server-side validation, FormCat is another set to do the same on the client side. What's preventing someone from making the two work from a single interface? The key thing seems to be that the server-side plugins would have to be able to generate a JS code block that's passed to the template, encapsulating the appropriate client-side validation. This would imply that the rules are defined only on the server side (i.e. not in the template), but then that's what SmartyValidate already does.
As I said I don't agree, but if you wanna give it a try a good starting point will be qforms.
I hadn't got as far as integration with form generation, but that would be the next logical step. Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture marcus@synchromedia.co.uk | http://www.synchromedia.co.uk

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