Hi, I just 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');
I am not sure if this is the way to integrate with Mask but it is working. Thanks, Miguel On Jun 19, 1:36 pm, shapper <[EMAIL PROTECTED]> wrote: > Please, anyone? > > Thank You, > Miguel > > On Jun 18, 11:18 pm, shapper <[EMAIL PROTECTED]> wrote: > > > Hello, > > > I am using masking and client validation in a form using: > > > Validator Plugin > > -http://bassistance.de/jquery-plugins/jquery-plugin-validation/ > > > Masked Input Plugin -http://digitalbush.com/projects/masked-input-plugin > > > In an input I have a Date Time in the following format: > > > yyyy-mm-dd hh:mm:ss > > > I am adding the masking as follows: > > > jQuery(function($){ > > $("#UpdatedAt").mask("9999-99-99 99:99:99"); > > }); > > > How can I validate my field integrating it with the mask and using a > > Regex to be sure that the date time is valid? > > I already have the Regex Expression: > > > ^([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])$ > > > The date and time are also required. > > > I already have the following: > > > // Form validation > > $("#Edit").validate({ > > errorClass: "Error", > > errorElement: "label", > > rules: { > > UpdatedAt: {required: true} > > }, > > messages: { > > UpdatedAt: { > > required: "Insert Updated date and time" > > }, > > }, > > }); > > > Could someone please help me? > > > I have been trying all day but until now I wasn't able to make this > > work. > > > Thanks, > > Miguel