You need to sign in to do that
Don't have an account?
adi salesforce
how to make input field read only in vf page
There are two record types in account. using Trigger I'm populating account industry field from record type 1 to record type 2 Now I want to make account industry as read only field in record type2
Edit the page layout for the record Type 2, and make the field read only.
Please mark this solved, if it had helped you. Thanks!
Regards,
Krishna Avva
To disable the input field using the attribute html-disabled=" true" in the input field.
You can use this code to check how it works here in the input field I have used the attribute HTML-disabled to disable the input field:
<apex:page standardController="Contact" recordSetVar="contacts">
<apex:form>
<apex:pageBlock title="Contacts List">
<!-- Contacts List -->
<apex:pageBlockTable value="{! contacts }" var="ct">
<apex:column value="{! ct.FirstName }"/>
<apex:column value="{! ct.LastName }"/>
<apex:column >
<apex:inputField value="{!ct.Email}" html-disabled="true" />
</apex:column>
<apex:column value="{! ct.Account.Name }"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha