function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Display decimal as integer in apex:inputField

I have an inputField which is a decimal, but if the existing value is an integer, I want to strip the decimals (e.g. show 5 instead of 5.00).


<apex:inputField value="{!myObject.Field__c}" />


Is there a way I can do this?


if the input field is decimal, there can never be an integer in that field (but that's just a minor detail) :) One way to avoid it as do some JS and use input textField to strip off the zeros on the page.