Skip to main content
5 of 5
replaced http://salesforce.stackexchange.com/ with https://salesforce.stackexchange.com/

Removing dot (thousands separator) in a numeric apex:inputField

I have one field "MyYear__c" on my custmon object. This field has following details:

Data Type: Number
Length: 4
Decimal Places: 0

At the visualforce page it looks like this:

<apex:inputField value="{!obj.MyYear_c}" required="true"/>

The user must fill this field out and then the outputPanel is re-rendered. After that there is a dot in this field:

enter image description here

Is there a way to remove the dot? I don't want to use any "not clear" solutions like Javascript. I want to know is there a "native" visualforce or apex solution for that. I know there are some workrounds, but only for the outputText, not for inputField.

Thank you.


Here my code:

Page:

<apex:pageBlock id="mainBlock">
    <apex:pageBlockSection columns="2">
        <apex:inputField value="{!obj.MyNumber__c}" required="true"/>
        <apex:commandButton value="Validate" action="{!doValidation}" reRender="mainBlock"/>
    </apex:pageBlockSection>
</apex:pageBlock>

Controller:

public MyObject__c obj { get; set; }

public MyClass(){
    obj = new MyObject__c();
}

public PageReference doValidation(){
    // Validation stuff here
    return null;
}
Sergej Utko
  • 22.1k
  • 11
  • 60
  • 88