如何处理 Xpage 中的本地化数值? [英] How to handle localized numeric values in Xpage?
问题描述
我有一个包含三个字段的 Xpage,均声明为 Number;名义、价格和付款金额.我想使用 Nominal * Price 计算 PaymentAmount.
I have a Xpage with three fields, all Number declared; Nominal, Price and PaymentAmount. I want to calculate the PaymentAmount using Nominal * Price.
在 SSJS onChange 中,我使用以下代码:
In SSJS onChange I use the following code:
var price = getComponent("Price").getValue();
从价格"字段中获取值.
to get the value from the field "Price".
在瑞典,我们输入我们的数值作为这个 #.###,## 1.234,56
In Sweden we enter our numeric values as this #.###,## 1.234,56
如果我在 Xpage 中输入值 Nominal=10 和 Price=2,5 并尝试使用上述公式进行计算,则存储在 var "price" 中的值将转换为 25 且类型为 long.
If I enter the values Nominal=10 and Price=2,5 in my Xpage and try to calculate using the above mentioned formula the value stored in var "price" is converted to 25 and of type long.
请指教
/M
推荐答案
不幸的是,我是个白痴.
I'm an idiot, unfortunatly.
这样做:
<inputText value="#{document1.Price}" id="Price" required="true" size="10">
<this.validators>
<validateRequired message="Price is required">
</validateRequired>
</this.validators>
<this.converter>
<convertNumber type="number" locale="sv">
</convertNumber>**
</this.converter>
</inputText>
它有效!
感谢大家的投入
这篇关于如何处理 Xpage 中的本地化数值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!