-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4497939
By: atmatm
Hi,
Is there a way to replace a decimal point in a decimalbox? At this time, the decimal point is comma (",") ... I'll change it for the point(".") because it's much simple to use with the keyboard.
I had tried with the "format" attribute but I don't find the best way... Can you help me please?
Thanks you in advance.
Best regards
Anthony.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4498088
By: matteo_barbieri
Hi, I use something like this
public class MyDecimalbox extends Decimalbox {
protected Object coerceFromString(String value) {
if(value != null && value.length() <= 0)
value = "0";
value = value.replace(".", ",");
return super.coerceFromString(value);
}
}
Bye
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4497957
By: jebberwocky
Dear Anthony
There is a very interesting article about number format pattern on sun website.
http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html
But, there is no method to set the "DecimalFormat" in decimalbox. you might want to post it to feature request. As a workaround, using textbox by implementing ur own formatter.
//JEFF
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4503827
By: atmatm
Hi,
We've found a solution to this problem:
Just add an attribute "action" on the decimalbox.
Like this: action="onkeyup:#{self}.value = #{self}.value.replace('.',',');"
Thanks for your help.
Best regards
Anthony
Excelente ayuda gracias.
action="onkeyup:#{self}.value = #{self}.value.replace('.',',');"
It's a lot simpler than you're making it. See my example here
If you go there and run it, you'll see that the locale attribute automatically does what you want. The nice thing about the locale attribute is you can override the user's default locale so they can choose to enter with dots instead of commas, or vice versa. Overriding the locale is probably a better choice, in my opinion.
Thank you Admin, action="onkeyup:#{self}.value = #{self}.value.replace('.',',');" works great for onChange.
Would there be a way directly for onChanging? So it's changed before it evens shows up?
Asked: 2007-09-03 10:16:14 +0800
Seen: 423 times
Last updated: Dec 09 '15