1. #11
    Sencha User
    Join Date
    Mar 2007
    Posts
    218
    Vote Rating
    0
    alien3d is on a distinguished road

      0  

    Default


    PHP Code:
    Ext.apply(Ext.form.VTypes,{
              
    'dollar':function () {
                  var 
    regex  = /^\$?[0-9]+(,[0-9]{3})*(\.[0-9]{2})?$/;
                  return function(
    strValue) {
                    if(!
    regex(strValue)) {
                        return 
    false;
                    } 
                } 
              },
              
    dollarMask:/[\d\$\,,.]/,
              
    dollarText:'Not a valid dollar amount.  Must be in the format "$230.45" ($ symbol and cents optional).'

    }); 
    ** the original one don't work on IE8 so i change a little bit

    PHP Code:
    var cop_lon_trg_amt = new Ext.form.TextField({
            
    labelAlign'left',
            
    fieldLabel'Amount',
          
            
    name'cop_lon_trg_amt',
            
    id'cop_lon_trg_amt',
            
    allowBlankfalse,
            
    blankText'Sila isi  Amount Target',
         
            
    vtype:'dollar',
            
    anchor'95%',
            
    listeners: {
                
    blur: function(){
                    var 
    value Ext.getCmp('cop_lon_trg_amt').getValue();
                    
    value value.replace(","""); // remove coma first
                    
    value Ext.util.Format.usMoney(value);
                    
    value value.replace(" """); // quite odd space problem
                    
    Ext.getCmp('cop_lon_trg_amt').setValue(value);
                }
            }
        }); 
    If any people can short cut it .okays .

  2. #12
    Sencha User brittongr's Avatar
    Join Date
    Jun 2007
    Location
    Panama
    Posts
    109
    Vote Rating
    3
    brittongr is on a distinguished road

      0  

    Default I developed this extension maybe it can helps others

    I developed this extension maybe it can helps others


    I just added my own extension maybe it can helps others...

    http://www.sencha.com/forum/showthre...pport&p=577701
    Last edited by brittongr; 6 Mar 2011 at 6:43 AM. Reason: added a comment
    Greivin Britton

    My Extensions:
    Ext.ux.NumericField: Number field with support for currencySymbol, thousand separator, international...
    Ext.ux.PagerSizeSelector: A plugin that allows the change page size with just one click.
    Ext.ux.FieldAccess: A plugin to let the user know which fields are editable.