-
18 Aug 2011 6:53 AM #1
Unanswered: Showing Currency in a Form
Unanswered: Showing Currency in a Form
I'm trying to display the currency that a number field is in somewhere in my field. It can be before the textfield, after the label, or even in the textfield (but I know that breaks the HTML5 number field, so that's fine).
How would I go about either putting the currency symbol before the textfield or at the end of the label?
My model looks like this:Code:fields = { xtype: 'fieldset', items: [ { name : 'amount', label: 'Amount', xtype: 'numberfield', labelAlign: 'left', labelWidth: '40%', required: false } ] };
How do I either refer to the model's currencySymbol in the Label, or somehow display it to the left of the textfield?Code:amountModel = Ext.regModel("app.models.Amount", { fields: [ {name: "amount", type: "int"}, {name: "currencySymbol", type: "string"} ] };
-
18 Aug 2011 7:12 AM #2Touch Premium Member
- Join Date
- Mar 2011
- Location
- New Jersey, USA
- Posts
- 130
- Vote Rating
- 0
- Answers
- 4
if you create your form after your currency store is loaded, you can retrieve the currencySymbol and add it to the label. for example:
I wouldn't advise putting the symbol in the textfield, though.Code:load: function(store, array)){ symbol = array[0].data.currencySymbol; //get the symbol ... //code setting up formPanel and other goodies //and you can use this like: label: 'Amount' + symbol, ... //rest of the code }
-
18 Aug 2011 10:13 AM #3
Thanks for the speedy reply, I'll give that a try!


Reply With Quote