# Inputbox & Decimalbox & ... behaviour for empty value - FYI

Steva77
1014 3
http://www.research.softe...

Hy guys,
since I spent some time to debug a complex page just to find out it was a really minor issue (I left a value empty), I took some time to check....
The following empty values returns different error messages:

<intbox value=""/>
java.lang.NumberFormatException: For input string: ""

<longbox value=""/>
java.lang.NumberFormatException: For input string: ""

<decimalbox value=""/>
java.lang.NumberFormatException

<doublebox value=""/>
java.lang.ClassCastException: Unable to find a setter named value that supports


and I could not find anywhere in the documentation that value MUST be specified.

FYI,
be well
Stefano

delete retag edit

## 3 Replies

paowang
140 6

I think ZK guesses the type of value and try to convert such value to expected type (ie. the property type of the component).
But the empty value has not enough information for guessing. Usually, the type of value will be "String".
Converting "String" to "Integer" (or other numeric types) is illegal in Java.

So, I think that we might not assign "value" property to component if there is no initial value.
For example, just <intbox />.

Hope this helps.

Steva77
1014 3
http://www.research.softe...

Thanks,
I see the point... although could this cause problems if I set the value dynamically by scripting?

<intbox value="\${someObject.uncheckedValue}"/>

Maybe ZK team might also refine a bit the exception message and make it the same for all.

Cheers
S

paowang
140 6

If property value is assigned from a expression, the situation will be a little different.
However, the type of someObject.uncheckedValue normally is same as the type of component's property.
The value doesn't need casting, so, it should be fine,

[hide preview]