views:

124

answers:

2

Just a quick question if someone has already that kind of setup or if there is some source code on the web.

I want to add some javascript validation to some Zend Forms. The straight forward approach would be to write the javascript myself but let's say it's time consuming(and that's not the kind of code your really want to write all day long).

I am wondering if someone wrote some decorators or view helpers to automatically generate that validation javascript?

Something using jquery.validate would be wonderful.

If not I suppose I am going to spend the 20 hours to do it myself ;-)

+3  A: 

a good start you can download sample of this project :

http://www.zendcasts.com/ajaxify-your-zend_form-validation-with-jquery/2010/04/

you can look on the movie

Haim Evgi
+1 It is a good link.
NAVEED
Thanks, I have seen this video during my googling of the issue. The thing is :yes it would work but I would still prefer something that do ajax requesst only for relevant parts, like making sure an email is not registered or whatever.
RageZ
+1  A: 

I think this is a valid question (and one I'm interested in as well), but as far as I know there isn't an automated solution at this point. One method I've considering is to try to have Zend_Form validators automatically add in keywords to the element that could then be "hooked into" from a more generic javascript solution (see jquery example below).

http://docs.jquery.com/Plugins/validation http://www.alistapart.com/articles/forward-thinking-form-validation/

I don't have any specific code/examples right now, but when/if I get around to doing it I'll check back.

jsuggs
@jsuggs thanks for the answer actually, one guy on Zend Jira made some js code for each zend validator: http://framework.zend.com/wiki/display/ZFPROP/Zend_Form_Decorator_JsValidation+-+Jani+Hartikainen . The proposal was in 2008 but I don't see any code in the realease which probably mean the project was dropped in the middle ... I think I would start taking a look at what the guy made and try to make my own.
RageZ