CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

How To Implement Specific Mask

by Aggie85 » 28 Feb 2015 21:06

Howdy All!

I am implementing a ticket barcode validation application for my reservation system.

The ticket bar-codes are 20 characters long. Each barcode starts with a +, has 18 Alphanumeric (A-F | 0-9) characters, and ends in a -.

In DevExpress TcxMaskEdit, I am able to use the following regular expression mask:

[+](\d | [A-F] | [a-f]){18}[-]

I tried using the mask option in JQEdit and the closest I could get is:

+******************-

which doesn't work because the mask validation code treats the + and - as "formatting" characters instead of input which I need because of barcodes contain them.

I was looking the http://digitalbush.com/projects/masked-input-plugin/ page and apparently it is possible to create your own mask definitions.

Could someone please tell how I would create something like:

jQuery(function($)
{
$.mask.definitions['B'] = "[A-Fa-f0-9]";
$.mask.definitions['~'] = "[+]";
$.mask.definitions['#'] = "[-]";
$("#TicketBarCode").mask("~BBBBBBBBBBBBBBBBBB#");
});

and add it to a JQEdit control?

Thanks in advance!

Aggie85
Aggie85
 
Posts: 273
Joined: 15 May 2013 02:24

by Alexander Bulei » 02 Mar 2015 16:14

Hi Aggie85,

Please check this simple example:

delphi code
IWCGJQEdit2.MaskOptions.Enable:= True;
with IWCGJQEdit2.MaskOptions.Definitions.Add do
begin
Name:= '~';
Value:= '+';
end;
with IWCGJQEdit2.MaskOptions.Definitions.Add do
begin
Name:= '#';
Value:= '-';
end;

with IWCGJQEdit2.MaskOptions.Definitions.Add do
begin
Name:= 'Z';
Value:= 'a-zA-Z';
end;


IWCGJQEdit2.MaskOptions.Mask:= '~ZZZZZ#';


Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3637
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by Aggie85 » 02 Mar 2015 16:32

Howdy Alex!

Thanks for the example.

i will try when i get out of jury duty!

Have a great day!

Aggie85
Aggie85
 
Posts: 273
Joined: 15 May 2013 02:24

by Aggie85 » 03 Mar 2015 04:26

Alex,

With a little more modifications, worked like a CHAMP!!!

Thank you very much!

Aggie85
Aggie85
 
Posts: 273
Joined: 15 May 2013 02:24

by ScottWGast » 28 Apr 2016 20:17

Hey Aggie85,

Were you ever able to get your mask working? I'm having a heck of a time getting the JQEdit.MaskOptions to work for a phone number and extension.

Are the .MaskOptions compatible with the standard Delphi mask options? I'm thinking not... All I'm trying to do is get this mask to work:

(999) 999-9999 aaaaaaaaaa;0;_

I've tried this regex mask (in both the .MaskExOptions.Mask and the .MaskOptions.Mask, to no avail:

((\d{3})) (\d{3})-(\d{4})((\d*))?

I need the 2nd parameter of the mask to be zero (0) so that it will save only the data entered, and not the mask characters.

Got any ideas?

Thanks,
Scott Gast
DXE2Updt4 / IW14.0.52 / CG 2.9.0.251
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Alexander Bulei » 29 Apr 2016 09:47

Hi ScottWGast,

Are the .MaskOptions compatible with the standard Delphi mask options? I'm thinking not... All I'm trying to do is get this mask to work:


I answer you in another topic.
In summary: No, the delphi mask is incompatible.

I've tried this regex mask (in both the .MaskExOptions.Mask and the .MaskOptions.Mask, to no avail:

((\d{3})) (\d{3})-(\d{4})((\d*))?


Already answer you....
Plugin have small issue with RegEx, we will fix it soon.
Use my suggested mask ;)

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3637
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by ScottWGast » 29 Apr 2016 16:59

TY!
sg
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02


Return to JQEdit

cron

Who is online

Users browsing this forum: No registered users and 2 guests

Contact Us.