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
DurgaPrasadChowdaryDurgaPrasadChowdary 

Making InputField as Readonly field

Hi,

I have an inputfield whichcan be updated based on another field's value.Ineed to make that input field as readonly after filling that field with the value..................can any one gave solution for that one.

shruthishruthi

Can you please post your code and the issue that you are running into?

DurgaPrasadChowdaryDurgaPrasadChowdary

what iam saying is i have an inputfield which should have the value as fieldset variable...........

iam trying to enter the value through javascript by getting the id of that input field and after filling that value using document.getElementById().value="some value".............and then i want to make that field as read only that means there the user shouldnot change that value after filling that value. 

shruthishruthi

If you do not want the user to change the value of the field and you want it to be read only, you can use

<apex:outputField>

you might have to use document.getElementById().innerHTML = "some value";

if you need the field to be of <apex:inputField > type for a while and then change into an <apex:outputField> you might have to use both

<apex:inputField> and

<apex:outputField>

and play around with its rendered attribute to be "true" or "false" as and when required.