jQuery validation and Lasso validation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

jQuery validation and Lasso validation

Greg Hemphill
Hi,

I've been having fun with the jQuery validation plugin lately, and I  
thought it would be nice to have a Lasso type and tags that performs  
similiar validation server side. I poked around on TagSwap and Nabble  
but didn't find a type designed for this purpose.  So my first  
question is, has anyone already done this?

Assuming there isn't a general purpose validation type freely  
available, I'm thinking I'll make one and put it up on TagSwap.  I  
thought I'd request a little feedback about syntax before I create it.

I'm thinking using the type would look something like this...

var( 'Email' = G_validation );
$Email = action_param( 'Email' );

then the validation syntax might look like

! $Email->required ? $Error = $Email->Error;
! $Email->email ? $Error = $Email->Error;
! $Email->maxlength( 256 ) ? $Error = $Email->Error;

or maybe

! $Email->validate( 'Required' ) ? $Error = $Email->Error;
! $Email->validate( 'Email' ) ? $Error = $Email->Error;
! $Email->validate( 'maxlength' = 256 ) ? $Error = $Email->Error;

or even

$Email->required;
$Email->email;
$Email->maxlength( 256 );
! $Email->validate ? $Error = $Email->Error;

or perhaps

! $Email->validate( 'Required Email', -maxlength=256 ) ? $Error =  
$Email->Error;

I'm leaning towards the last example, but thought I'd see what ya'll  
think.

This is the jQuery Validation plugin I'm referring to:
http://docs.jquery.com/Plugins/Validation
http://bassistance.de/jquery-plugins/jquery-plugin-validation/



--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: jQuery validation and Lasso validation

Bil Corry-3
Greg Hemphill wrote on 1/9/2009 8:04 AM:
> I've been having fun with the jQuery validation plugin lately, and I
> thought it would be nice to have a Lasso type and tags that performs
> similiar validation server side. I poked around on TagSwap and Nabble
> but didn't find a type designed for this purpose.  So my first question
> is, has anyone already done this?

It's been on the "to-do" list for AutoValidate for a long time, and I was going to explore marrying the Validation plug-in for jQuery to it.  I think it's a great project to implement, and I believe there is already something similar in PHP, so you might see how they choose to implement it.


- Bil


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: jQuery validation and Lasso validation

jasonhuck
An approach we took for a recent project was to create a custom type
that interfaced with a database containing specific validation rules
(what type of form input should be used, what type of data should it
accept, what are valid ranges for that data, etc). The type had a
member tag to create the necessary markup (input with the usual
attributes plus the webforms attributes used by the validation plugin
like min and max, and the special classes like number, decimal, etc.,
along with a label), and another to do the server side validation. We
had a single set of validation rules for the jQuery plugin that worked
across all inputs since the item-specific data was stored in the
webforms attributes for each input. This is for a non-public web app
with a very small number of trusted users, so we chose the convenience
of the webforms method vs. the security of looking up all the
validation attributes behind the scenes, but it could be adapted to
work that way as well.

- jason



On Fri, Jan 9, 2009 at 9:10 AM, Bil Corry <[hidden email]> wrote:

> Greg Hemphill wrote on 1/9/2009 8:04 AM:
>> I've been having fun with the jQuery validation plugin lately, and I
>> thought it would be nice to have a Lasso type and tags that performs
>> similiar validation server side. I poked around on TagSwap and Nabble
>> but didn't find a type designed for this purpose.  So my first question
>> is, has anyone already done this?
>
> It's been on the "to-do" list for AutoValidate for a long time, and I was going to explore marrying the Validation plug-in for jQuery to it.  I think it's a great project to implement, and I believe there is already something similar in PHP, so you might see how they choose to implement it.
>
>
> - Bil
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>
>



--
tagSwap.net :: Open Source Lasso Code
<http://tagSwap.net/>

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/