Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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;
}
share|improve this question
    
where comma is? I can only see dot. –  doga Feb 26 '13 at 9:13
    
@doga thanks man, i just missed that ;) –  mast0r Feb 26 '13 at 9:15
    
Can you post your controller code? –  Kevin O'Hara Feb 26 '13 at 15:07
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

1 Answer 1

up vote 1 down vote accepted

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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