Hi,

I know those examples and I kind of solved it using:

$.validator.addMethod('sqldatetime', function (value) {
  return /^([0-9]{4})-([0-1][0-9])-([0-3][0-9])\s([0-1][0-9]|[2]
[0-3]):
([0-5][0-9]):([0-5][0-9])$/.test(value);

}, 'Check your date and time. Use the format yyyy-mm-dd hh:mm:ss');

However I am not sure if this is full integrated.
I mean this does not give me the option to access empty fields ... Of
course I can change my Regular Expression or add an if to the method
to validate only if the value is not empty ...

Anyway, Is this the way to integrate Validate and Mask? I checked the
code on the examples but I am not sure if I am doing this the right
way.

Thanks,
Miguel

On Jun 19, 4:27 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
wrote:
> Here is an example using both 
> plugins:http://dev.jquery.com/view/trunk/plugins/validate/demo/marketo/
> The second step changes the creditcard mask based on another 
> field:http://dev.jquery.com/view/trunk/plugins/validate/demo/marketo/step2.htm
>
> Jörn
>
> On Wed, Jun 18, 2008 at 7:11 PM, shapper <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > I am validating a form but one of the fields has a mask:
> > 99-99-9999 99:99:99
>
> > This is:
> > Day-Month-Year Hour:Minutes:Seconds
>
> > How can I integrate my validation with my mask?
>
> > I am using:
> >http://digitalbush.com/projects/masked-input-plugin
> >http://bassistance.de/jquery-plugins/jquery-plugin-validation/
>
> > I am not sure if these are the right plugins for this ... at least
> > this is what I have been using.
>
> > Could someone, please, help me out?
>
> > Thanks,
> > Miguel
>
> > Here is my code:
>
> >      // Form mask
> >      jQuery(function($){
> >        $("#UpdatedAt").mask("99-99-9999 99:99:99");
> >      });
>
> >      // Form validation
> >      $("#Edit").validate({
> >        errorClass: "Error",
> >        errorElement: "label",
> >        rules: {
> >          Name: {required: true},
> >          UpdatedAt: {required: true}
> >        },
> >                    messages: {
> >                            Name: {required: "What is your name?"},
> >                            UpdatedAt: {
> >                              required: "Insert the updated date and time"
> >                            },
> >                          },
> >      });

Reply via email to