Hi guys, I've got a pie in the sky idea, and I'm just wondering if it's even
remotely possible, or if I should give up and try something else.

I've got a bunch of Zend_Dojo_Form forms with a bunch of custom validators
on the Zend side - they work fine, the form errors out when values are
incorrect, it's all working exactly as you'd expect, however, what I'd also
like is for the same validators to work on the Dojo client side of the form
- but without having to completely re-implement them, validator by
validator.

I understand that at its simplest level, the Dojo isValid method doesn't
know or care about the application behind it, and indeed for it to even be
able to get access to the errors in the application it'd have to attempt a
submit, which isn't what it's meant to do, but has anyone tried a system of
something like:

1. override form onSubmit to add our code
2. test Dojo isValid()
3. if the Dojo side is happy, AJAX submit the form
4. if successful, which would be returned i don't know how, then forward on
to the appropriate page
5. if not successful, then (and this is where it gets tricky I guess) pass
back enough data to know what field errored out, what the error was, and
then call enough of the Dojo isValid internal guts to make the form look
like it didn't validate?

Sorry to just be airing ideas like this, I just figured it might be really
useful if we could come up with a way to sort of globally add custom
validators to our forms that work both client and server side, without
having to implement them uniquely on both sides.

Reply via email to