PDA

View Full Version : Number Field with currency formatting



JSCoder
2 Sep 2009, 7:55 AM
Just kidding, this ain't a spam thread. I need some help. (duh!)

On a webpage, I have some html text inputs, all with the class 'money'.



<input type="text" class="money">
On load, I process them like this:



Ext.each(Ext.DomQuery.select("input.money"), function(item){
new Ext.form.NumberField({
'applyTo': item,
'id': item.id,
'value': item.value,
'allowBlank': false,
'allowNegative': false,
'maxValue': 100000
});
});
But by doing this, I don't get the component where the value is displayed as dollar currency, in the format $ 21,000.00

I've seen the dollar fields in the EXTJS examples. Clicking and editing them hides the $ symbol and the commas, and presents the decimal number only. When the component loses focus, the newly entered value is once again displayed as currency.

How can I achieve the same?

tryanDLS
2 Sep 2009, 9:39 AM
Please give your thread a real title - that's why your post got moderated. We really don't need to waste more time moderating threads of people that should know better.