-
FEATURED COMPONENTS
First time here? Check out the FAQ!
in Decimalbox when I get the value myDecimalbox.getValue() loss the scale (I use 3 decimals) and the scale remains in "0" and when if try to save a value of 123.456 ( myVar = myDecimalbox.getvalue() ) I obtain 123456
Any idea?
thank you
Pedro Gonzalez
the error is in toNumberOnly(value)
my value is 44.553 and toNumberOnly set a scale of "0" (the scale is "3")
the error is when i don't touch the decimalbox...
Decimalbox.java
protected Object coerceFromString(String value) throws WrongValueException { final Object[] vals = toNumberOnly(value); final String val = (String)vals[0]; if (val == null || val.length() == 0) return null; try { BigDecimal v = new BigDecimal(val); if (_scale != AUTO) v = v.setScale(_scale, getRoundingMode()); int divscale = vals[1] != null ? ((Integer)vals[1]).intValue(): 0; if (divscale > 0) { final BigDecimal ten = new BigDecimal(10); do { v = v.divide(ten, _scale == AUTO ? v.scale()+1: _scale,
or maybe the error is in the file: InputElement.java
-->> same = Objects.equals(_value, val);
_value = 44.553
val = 44553
obviously not same, but i'dont change it
public void setText(String value) throws WrongValueException { if (_maxlength > 0 && value != null && value.length() > _maxlength) throw showCustomError( new WrongValueException(this, MZul.STRING_TOO_LONG, new Integer(_maxlength))); final Object val = coerceFromString(value); final boolean same = Objects.equals(_value, val); boolean errFound = false; if (!same || !_valided || _errmsg != null) { //note: the first time (!_valided) must always validate validate(val); //Bug 2946917: don't validate if not changed errFound = _errmsg != null; clearErrorMessage(); //no error at all }
this is my code in the file .zul
<decimalbox id="arcostoult" cols="10" constraint="no negative" maxlength="9" action="onkeyup:#{self}.value = #{self}.value.replace('.',',');" />
any idea?
thank you
Pedro Gonzalez
my number is formatted like this: 149,50
if I modify the number (Decimalbox), not problem.
if I don't modify the number, when I get the value arcostoult.getValue() this value change for 14950
the problem I think is the "," like decimal...
then, the error is in toNumberOnly(value)
please, help...
Pedro Gonzalez
Push
Asked: 2010-03-29 11:04:37 +0800
Seen: 447 times
Last updated: Apr 16 '10