extJS: VType for validating a time

|

I needed a VType for validating a time using the extJs framework in the format HH:MM (24 hour clock, no ‘AM’ or ‘PM’) and couldn’t find one that quite fit the bill, so a tweaked version is:

Ext.form.VTypes[“timeVal”] = /^([0-9]|1[0-9]|2[0-3]):([0-5][0-9])$/i;
Ext.form.VTypes[“timeMask”] = /[\d\s:amp]/i;
Ext.form.VTypes[“timeText”] = ‘Not a valid time.  Must be in the format hh:mm”.’;
Ext.form.VTypes[“time”] = function(v)
{
    return Ext.form.VTypes[“timeVal”].test(v);
}

Related Linkage:

About this Entry

This page contains a single entry by Robert Wray published on December 16, 2008 8:30 AM.

Adding groups and summaries to the asp:GridView was the previous entry in this blog.

extJs: getClientRects() error is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 5.04