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
BrettGusBrettGus 

Value format in apex:InputText

I have an Integer value that I'm assigning to a apex:InputText.  However, it displays as a displays with a decimal point "4654.0" when I use a apex:InputText as opposed to apex:InputField.  Is there any way to specify formatting for this number?  If not, is there a workaround?

 

Edit:

By the way, the reason I want to use an apex:InputText is so that I can set the item to disabled.

Best Answer chosen by Admin (Salesforce Developers) 
Ralph CallawayRalph Callaway

It's not glamorous, but you could always use jQuery to disable it on the client side

All Answers

Ralph CallawayRalph Callaway

InputText doesn't appear to have any brains about formatting and will display an integer the same as a decimal.

 

To work around this instead you could do something like this

 

<apex:outputField value="{!yourValue}" rendered="{!inputDisabled}/>
<apex:inputField value="{!yourValue}" rendered="{!NOT(inputDisabled)}">

 

BrettGusBrettGus

That's a good workaround!  Unfortunately what I'm trying to do is editable data side by side with non-editable data.   To make it look consistent I wanted to have a disabled and non-disabled input boxes side by side (rather than one be text and the other an input box) with both displaying data.  Thanks for trying anyway!

Ralph CallawayRalph Callaway

It's not glamorous, but you could always use jQuery to disable it on the client side

This was selected as the best answer
BrettGusBrettGus

Yeah it's not but I think jQuery best matches what I'm trying to do