-
22 Jan 2008 4:25 AM #1
Mask Input Plugin for TextField - Cross Browser
Mask Input Plugin for TextField - Cross Browser
Credits for:
Softfocus Sistemas: www.softfocus.com.br
Demo: http://www.ricardosantos.com.br/extjs/example-form.php - Ext 1.0
I caught him the script and modified for use with 2.0 ext
work fine in ie, firefox, opera..
Someone can test with the safari?
ext-extend.js
[CODE]
Ext.namespace("Ext.ux","Ext.ux.form");
Ext.QuickTips.init();
// Extends Javascript Functions
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); };
//
// form extends
//
Ext.ux.colfield = function(form, type, label, name, width, objconffield, objconf )
{
var config = {
width: width
};
Ext.apply( config, objconf );
var newField = Ext.ux.retfield( type, label, name, objconffield )
return newField;
}
Ext.ux.retfield = function( type, label, name, width, objconf )
{
var newField = {}, config = {
fieldLabel: label,
name: name,
width: width,
preventScrollbars: true,
cls: '',
allowBlank: true
};
Ext.apply( config, objconf );
if( config.width == undefined || config.width == 0 ) delete config.width;
switch( type )
{
case 'e':
config.vtype = 'email';
case 't':
case 'text':
var newField = new Ext.form.TextField( config );
break;
case 'tn':
case 'textnome':
var newField = new Ext.form.TextField( config );
newField.on('change', function( field, str ) { field.setValue(Ext.ux.form.masknome(str)); });
break;
case 'tel':
config.maskRe = /[0-9]/;
config.mask = '(##) ####-####';
config.minLength = 9;
config.valueDefault = '(13';
var newField = new Ext.form.TextField( config );
Ext.ux.form.Masking( newField );
break;
case 'cpfcnpj':
config.maskRe = /[0-9]/;
config.mask = config.mask1 = '###.###.###-##';
config.mask2 = '##.###.###/####-##';
config.minLength = 14;
var newField = new Ext.form.TextField( config );
Ext.ux.form.Masking( newField );
newField.on('valid', function( field ) {
var v = field.getValue(), n = v.replace( /[^0-9]/g, '' );
if( n.length == 11 && !Ext.ux.form.chkcpf(n)) field.markInvalid('O CPF est
-
23 Jan 2008 2:38 AM #2
Do you have an example running?
-
23 Jan 2008 3:25 AM #3
-
23 Jan 2008 1:36 PM #4
This forum in for Ext 2.0 extensions and plugins.
-
23 Jan 2008 4:21 PM #5
Really need to read everything before reprimanding someone.--------------------------------------------------------------------------------
Credits for:
Softfocus Sistemas: www.softfocus.com.br
Demo: http://www.ricardosantos.com.br/extjs/example-form.php - Ext 1.0
I caught him the script and modified for use with 2.0 ext
-
25 Jan 2008 2:30 PM #6
-
29 Jan 2008 4:27 AM #7
I need to modify the source to work correcty...
original line 21:Modified line 21:Code:var newField = Ext.ux.retfield( type, label, name, objconffield )
Thanks for this perfect plugin.Code:var newField = Ext.ux.retfield( type, label, name, width, objconffield )
-
29 Jan 2008 9:35 AM #8
in the next time will be possible use
xtype: 'inputMask',
mask: '###-##-##'
thanks for your suggestion
are be appreciate
-
31 Jan 2008 10:56 AM #9
Safari not good :(
Safari not good :(
There are some problems in safari :

-
2 Feb 2008 8:49 AM #10



Reply With Quote