-- Mark Maynereid <[EMAIL PROTECTED]> wrote
(on Monday, 03 December 2007, 05:09 PM -0800):
> I see you mention AJAX for client side validation, and note others
> have commented on ZF/AJAX concerns in general. I imagine trying to
> deliver a decent quality AJAX library from scratch now would be
> daunting. Yet AJAX is expected these days so perhaps third party
> libraries are inevitable here (for now).
> 
> Also personally, I do not particularly enjoy having to write code
> twice (first to write server side validation in PHP, and then have to
> write the code yet again in Javascript for client side validation).
> Then have to keep it in sync and maintain a doubled up codebase. My JS
> is weak anyway.

Actually, the AJAX way to do this is to send an XHR request to the
server, and have the server validate and return status. Doing this
avoids code duplication, and also makes the JS slimmer. The downside is
you have potentially more calls to the server -- which is why I
typically *don't* do validation of individual elements, and instead save
that for the final form submission.

> Wouldn't it be cleaner to hand off the whole AJAX thing so we can
> treat it like a black box and control it purely from PHP? 

As others have commented, and I have as well, I think this is not a
great direction. Leave validation to the server-side (optionally
allowing AJAX validations), but otherwise the only JS PHP should be
generating is JSON.


> Those that want to are then freed from Javascript coding entirely, and
> as a massive bonus, the server side validation code potentially
> becomes common to the client side validation code! Codebase
> duplication eliminated :)  While trawling the XJAX libraries I came
> across the xajax project which appears to do precisely this:
> 
> Here's a quick 10 minute overview:
> http://www.xajaxproject.org/docs/xajax-in-10-minutes.php
> 
> I have played with xajax a little and if it is as good as it appears, I
> would love to see provision for it in ZF. My hunch is it could also prove
> the easiest and tidiest of all ZF AJAX solutions to roll out first precisely
> because of its apparently unique 100% PHP API. Any good?
> 
> 
> Regards,
> Mark
> 
> 
> 
> Matthew Weier O'Phinney-3 wrote:
> > 
> > -- Mark Maynereid <[EMAIL PROTECTED]> wrote
> > (on Monday, 03 December 2007, 11:38 AM -0800):
> > Not yet; I hope to have a full proposal out later in the week; more on
> > that below. The ideas I'm looking at now are:
> > 
> >   * "sectioned" forms -- i.e., forms that have grouped items
> >   * Element dependencies (elements whose validations depend on the
> >     values of other elements)
> >   * Multi-page forms
> >   * AJAX interaction:
> >     * Validating single or multiple elements via AJAX
> >     * Autocompleters
> > 
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Zend_Form-tf4719410s16154.html#a14142670
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to