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
sreenathsreenath 

dont need decimal value for items(number) field

Hi developers,

 

please solve my problem................

 

i am getting decimal output, i dont need only i will display number without decimal

what change i need to do?

NO. of items:<apex:outputPanel ><apex:inputField style="width:100px;" value="{!items.item1__c}" </apex:outputPanel>

 

this is sample code to convert number format with decimal points

<apex:page standardController="Account">
It is worth:
<apex:outputText value="{0, number, 000,000.00}">
       <apex:param value="{!Account.AnnualRevenue}" />
 </apex:outputText>
</apex:page>


                         

aballardaballard

Since you are using inputField to display it, the format is determined by the definition of the custom field item1__c .  Can you change the custom field definition to not specifiy decimal positions?

Pradeep_NavatarPradeep_Navatar

Find below a sample code :

 

                <div style="display:none">

                                <apex:outputPanel>

                                                <apex:inputField style="width:100px;" value="{!items.item1__c}" >

                                </apex:outputPanel>

                </div>

 

                <script>

                                if('{!items.item1__c}' != '' || '{!items.item1__c}' != null)

                                {

                                                var itm = '{!items.item1__c}';

                                                // take only integer value from itm in IntValue variable then put it in outputtext

 

                                                document.getElementById('{!$Component.xyz}').value = IntValue;

 

                                                document.getElementById('abc').style.display = 'block'

                                }

                </script>

WYamWYam

I agree with aballard on the output view.

 

You could also try to remove the decimal points in your inputext field to see if that helps. 000,000 instead of 000,000.00

ritharitha

try this {!Text(value)}

DNA by the BayDNA by the Bay

Hey, I searched this thread to find my answer, and your response was perfect. Thanks a million!