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
psplrockspsplrocks 

Read Only property for input text

Is there any Read only property for an input text box in VF page.

I want to make the Text Box value readonly.

Ex:

 <apex:inputtext style="border:0px;background-color:#F3F3EC;" size="30" disabled="false" value="{!inputText}"/> 

 

can we make a textbox readonly in apex...if possible please help me..  

 

Thanks

 

Edwin VijayEdwin Vijay

<apex:inputtext style="border:0px;background-color:#F3F3EC;" size="30" disabled="true" value="{!inputText}"/> 

 

 

hope this helps.. 

 

psplrockspsplrocks

Hey,

Thanks for the reply. 

I used this property earlier but this property disables the entire text i just want to make the text a readonly value instead of making it disable.

JimRaeJimRae

Why not use an outputtext tag instead.  Your field would display, but could not be updated.

 

 

<apex:outputtext style="border:0px;background-color:#F3F3EC;" value="{!inputText}"/>

 

 

Gaurav-GuleriaGaurav-Guleria

Hi psplrocks,

 

Use the tag:<apex:outputtext/>

 

 

 

pats1976pats1976

What if you are using a Datepicker to populate your inputText field and want to enforce the user to chose only the date picker ?

Owais Majid 7Owais Majid 7
Use html-readonly="true". It will do the trick for you.
Daris PaulinoDaris Paulino
Better late than never: readonly="true" in the <apex:inputTextarea> element