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:


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


public MyObject__c obj { get; set; }

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

public PageReference doValidation(){
    // Validation stuff here
    return null;
  • where comma is? I can only see dot. – doga Feb 26 '13 at 9:13
  • Can you post your controller code? – Kevin O'Hara Feb 26 '13 at 15:07
  • @KevinO'Hara Hey Kevin, i don't think it will help, but i've posted my code (very simplified). – Sergej Utko Feb 26 '13 at 16:15
  • 2
    Here's the idea to support number display formats. I think you'd need something like that if you want to use inputField and no JS. – Peter Knolle Feb 26 '13 at 16:50
  • 2
    Thanks to the constraints on the edit page, not in any way that would be desirable (ie a full override, but that defeats the page layout in general). Another option would be similar to your formula field solution, but instead of a formula field use a text field and then coordinate the validation and values between the two via workflows/triggers. So your "public" field would be text, and your value field would be the current one. – joshbirk Feb 26 '13 at 20:38

Have you tried using inputText in your Visualforce?:

<apex:inputText value="{!obj.MyNumber__c}" required="true"/>

You will need to validate that the text is a number in your controller.

You will also need to make use of a formula field for standard UIs.

  • I will accept this answer as only solution for the "problem", apparently there are no other "native" solutions. Thanks Stephen. – Sergej Utko Feb 27 '13 at 7:36

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.