You need to sign in to do that
Don't have an account?

How to display a decimal value default to 2 zero after decimal point
I have textbox which has a decimal value fetched from controller. I need to show the value with 2 zero's after decimal point. Currently its displaying just 1 zero.
<apex:inputText styleclass="tb2" value="{!a.TimeCardObj.Monday_Hours__c}"/>
Thanks
Prady
Youi can solve this by adding a zero manually :
If the returned value from controller is 7.25 then would it not display 7.250? I just want to show 2 places in decimal.
You ca use javascript to format this field.
var val = document.getElementById('inputTextId').value;
val = val.substring(from . to val.length);
and then
if(val.length < 2)
document.getElementById('inputTextId').value = document.getElementById('inputTextId').value + '0';
I've never try with an inputfield, but with output, there is a formatting functionnality.
<apex:outputText value="{0, Number, #0.00}"><apex:param value="{!a.TimeCardObj.Monday_Hours__c}" /></apex:outputText>
Hey Thanks , I was not aware with such kind of functionality.
I tried this with the input field , but doesn't support.
Hi Guys
Any further progress on this?
Regards
Ross
Hey,
It works perfectly.
Sorry I'm looking for way to format the text on a INPUT (not an OUTPUT)
Thanks
Ross
great solution for me, exactly what I needed - thx!