It would be possible, although I don't think Regex in JS and PHP are
exactly the same, simple constructs should be close enough.

However, there are already heaps of very powerful JS validation
librarys around that are proven.  The best IMHO being
http://bassistance.de/jquery-plugins/jquery-plugin-validation/
(although I am biased towards jquery)

The basics approach would be to pass your validation rules to the view
and then have the view setup the JS validation based on your php
validation rules.  This would be best acheived with a helper.  With
1.2, a new validation construct has been implemented that is not a
pure regex based approach, you can use member methods as well, which
will make this idea really hard to implement.

Geoff
--
http://lemoncake.wordpress.com

On Jul 3, 5:49 am, crouchjay <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> Since the javascript regexp contains the same syntax as php, as far as
> I know (in my limited knowledge), I was wondering if there was a way
> to send my global validate variables to a javascript variable to use
> as variables in the java script similar to the validation process of
> cakephp?
>
> Is this possible?
>
> Currently, I am trying to work with prototype.js and extending the
> form class to work like the cakephp class validator, but I am
> wondering if I only need to store my validator variables in one spot,
> or would I need two copies (one php and the other javascript)?
>
> thanx,
> jay


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to