0

Decimal box issue in Format

asked 2012-01-06 11:36:13 +0800

siva477 gravatar image siva477
57

HI,

I declare a Decimalbox in ZUL.
set maxLength of DecimalBox = 15.
set Format = #,###.##

At run time of Execution I entered Number with 15 digits and come out from Decimal box. Immediately it calls onblur event in backend and entered 15 digit number splitted with comma(",") and add rational 2 digits at the end. then it Shows a error for entering length of Number greater than 15. What is the solution to neglect the calculation of comma's in length of DecimalBox value. But set format of that value is necessary.


Example:

value I entered: 123456789456789

After Blur value in Decimal box: 123,456,789,456,789.00

So Total length of value becomes 22. then it shows Error to reach of max value 15.

Can anybody give me a solution to solve this...
Thanks in Advance

With Regards,
Siva Kumar

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2012-11-01 04:12:40 +0800

gamefeeder gravatar image gamefeeder
33 3

i got the same problem. but no one answered this even after 10 months....... :(

link publish delete flag offensive edit

answered 2014-01-31 08:58:14 +0800

digulla gravatar image digulla
506 5

It would be nice if the length checking code would remove all useless characters before checking the length (just like the coercion code does when the String is converted back to a number).

link publish delete flag offensive edit

answered 2015-05-15 14:14:16 +0800

Worsik gravatar image Worsik
1

updated 2015-05-15 14:15:17 +0800

I think that all maxlength functionality is wrong in ZK. For example when you need to show a form with values from different source. When these values exceed maxlength, your form will not appear and WrongValueException is thrown. That's why I use my own maxlength validation. I am using my own Constraints which can handle more validation requirements than only one. I have constraint which throws MandatoryFieldException, MaxLengthException and InvalidFormatException in method validateThrowing(). This method is then called from method validate(), where I can handle my own reaction on validation error. For example highlight invalid inputs. Then my form is shown even if values are not valid. Bad thing is that you are not stopped from writing when you exceed max length limit.

I had similar problem and now for BigDecimal I use generated maxvalue for compare. For example when you have maxlength 13 and your decimal has scale 4, then you generate string from "." appending 4 * '9' and prepending '9' to total length 13.

OMG, I just realized that this is soooo old question... Sorry for that

link publish delete flag offensive edit

answered 2018-10-30 15:31:39 +0800

phannhuson gravatar image phannhuson
1

I can not use maxlength in decimalbox, but i use [if (IDDECIMAL.getText().replace(",", "").length()>15) { showNotification("OVER 15 LETTER"); IDDECIMAL.focus(); return false; }]

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: 2012-01-06 11:36:13 +0800

Seen: 349 times

Last updated: Oct 30 '18

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