0

Replace the decimal point in a decimalbox

asked 2007-09-03 10:16:14 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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.

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2007-09-03 11:24:01 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

link publish delete flag offensive edit

answered 2007-09-03 16:17:05 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

link publish delete flag offensive edit

answered 2007-09-06 06:57:48 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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



link publish delete flag offensive edit

answered 2012-11-28 21:52:20 +0800

geovanny1781 gravatar image geovanny1781
3

Excelente ayuda gracias.
action="onkeyup:#{self}.value = #{self}.value.replace('.',',');"

link publish delete flag offensive edit

answered 2012-11-29 02:39:46 +0800

rdgrimes gravatar image rdgrimes
735 7

updated 2012-11-29 03:33:32 +0800

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.

link publish delete flag offensive edit

answered 2015-12-09 14:33:00 +0800

WilliamB gravatar image WilliamB
1609 1 6

updated 2015-12-09 18:01:17 +0800

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?

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2007-09-03 10:16:14 +0800

Seen: 423 times

Last updated: Dec 09 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More