Hello,
I'm trying to extend NumberField to AmountField, but how to do that ?

Code:
Ext.namespace('Ext.ux.form');

Ext.ux.form.AmountField = Ext.extend(Ext.form.NumberField, {	
	validationEvent:'keyup',
 
	decimalSeparator: '.',
	decimalPrecision: 2,
  
  	allowNegative : false,
  	
  	maxValue : 999999.99,
  	maxText : "La valeur de ce champ dépasse le montant maximal autorisé.",
	autoCreate: {tag: 'input', type: 'text', autocomplete: 'off', maxlength: '9'},

	setValue : function(v){           
            v = isNaN(v) ? '' : this.fixPrecision(String(v).replace(".", this.decimalSeparator));
            return Ext.form.NumberField.superclass.setValue.call(this, v);
	},
    
        fixPrecision : function(value){
            var nan = isNaN(value);
            if(!this.allowDecimals || this.decimalPrecision == -1 || nan || !value){
               return nan ? '' : value;
            }            
            return parseFloat(value).toFixed(this.decimalPrecision);
	}
});

Ext.reg('amountfield', Ext.ux.form.AmountField);
Now, my first simple form :
Code:
var testForm = new Ext.form.FormPanel({
	width: 250,
	height: 100,
	items: [
		{ xtype : 'numberfield', fieldLabel: 'A classic NumberField' },
		{ xtype : 'amountfield', fieldLabel: 'My AmountField'  }
	]
});
2011-01-21_160239.png
Ok, When I enter a value, the field behavior is correct.

But, if I put several "AmountField" like this:
Code:
var testForm = new Ext.form.FormPanel({
	width: 250,
	height: 100,
	items: [
		{ xtype : 'numberfield', fieldLabel: 'A classic NumberField' },
		{ xtype : 'amountfield', fieldLabel: 'My AmountField'  },
		{ xtype : 'amountfield', fieldLabel: 'Second AmountField'  }
]
});
2011-01-21_161059.png
Only the last field is ok, and I not understand why, for sure, I missed something, but what ?...

I need your help,
Thanks in advance,