[SalesForce] Is it possible to exclude fields from inline editing

With visualforce, I'm using <apex:inlineEditSupport /> inside e.g. <apex:pageBlockTable> quite often. It makes all outputFields editable. Fine. Now, is there a way to exclude some fields from being editable, e.g. you have {!sample__c.startDate__c} and {!sample__c.endDate__c} and want only startDate__c to be editable?

I know, there is <apex:outputText> which does exactly that, but <apex:outputText> can't handle localized dates as you will find on various places:
https://salesforce.stackexchange.com/search?q=visualforce+date+format
Without further investigation, I simply assume outputText will also end up in mess when it comes to localized time, numbers, currency and so on. In short, for most of my use-cases outputText simply sucks in the way it seems to be intentionally designed for now.

So I think a have to stick with outputField, which does all the localizations like a charm – but then I have to find a way to somehow break the inline-edit for some exceptions, which I want not to be editable. Probably I'll find it when a start to play around with the JS for a while… but I'm just wondering if anyone found it already? Clean, less-hackish approaches preferred.

Best Answer

According to the Docs.... Reference

Can't you just wrap set your specific fields you want to disable?

IE:

     <apex:outputField value="{!contact.firstname}">
          <apex:inlineEditSupport disabled="false"/>
     </apex:outputField>
     <apex:outputField value="{!contact.lastname}">
          <apex:inlineEditSupport disabled="true"/>
     </apex:outputField>
Related Topic