af:convertNumber element removes zero in the end of the value

506 views Asked by At

My code:

<af:inputText id="it1" label="Test">
   <af:convertNumber groupingUsed="true" type="number" messageDetailConvertNumber="#,###,##" maxFractionDigits="2"/>
</af:inputText>

When I type 100,51 -- everything is fine, but if I would type 100,50, then '0' will be removed and entered value will be 100,5. How can I leave this '0' in the end?

I need <af:convertNumber> element for other stuff and I need this '0' to be present. Any thoughts?

BR,
Raimonds

2

There are 2 answers

0
cнŝdk On BEST ANSWER

You are using the property maxFractionDigits="2", use minFractionDigits="2" for this:

<af:convertNumber groupingUsed="true" type="number" 
                  messageDetailConvertNumber="#,###,##" 
                  maxFractionDigits="2" minFractionDigits="2"/>

Take a look at the JSF Converters Documentation for further information about it.

0
Florin Marcus On

You can try with:

messageDetailConvertNumber="###,###.00"