5

I am new to email templates and I have a value {!relatedto.RST_Amount__c} that only displays 1 decimal point when sending an email.

The way I usually fix this is by doing a .toFixed(2) with javascript, however I am not sure how I can update my outputLabel (or any other suggested field) with a javascript

What I have tried:

function toFix()
{
  var x - document.getElementByID('test1');
  var value = x.innerHTML.toFixed(2);
  x.innerHTML = y;
}
<apex:outputLabel value="{!relatedto.RTS_Amount__c}" id="test1"/>

With visalforce emails I cannot to an onload="toFix()" it seems on the

I am at a loss for the moment, any help would be greatly appreciated.

7
<apex:outputText value="{0,number,#,##0.00}">
<apex:param value="{!relatedto.RTS_Amount__c}" />
</apex:outPutText>

Use outputtext with apex:param and you should be good with above code.

  • Thanks for the quick feedback Mohith, I get an error when using your suggestion Error: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice. – jnoel10 Oct 16 '13 at 14:49
  • RTS_Amount__c this is of what data type.I mean field – Mohith Shrivastava Oct 16 '13 at 14:50
  • I am sorry, could you edit your answer it is still unclear for me. – jnoel10 Oct 16 '13 at 14:51
  • I am sorry too.I assume your RTS_Amount__c field is a currency or number or decimal ?I just want to know the datatype of this field so that i can help.Thanks – Mohith Shrivastava Oct 16 '13 at 14:54
  • it is of type currency – jnoel10 Oct 16 '13 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.