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.


According to the Docs.... Reference

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


     <apex:outputField value="{!contact.firstname}">
          <apex:inlineEditSupport disabled="false"/>
     <apex:outputField value="{!contact.lastname}">
          <apex:inlineEditSupport disabled="true"/>
  • Great! Thanks a lot @DoubleA, his I was looking for! I'll give it a try and come back with the results. – Uwe Heim Jul 10 '14 at 14:04
  • Yes @DoubleA this exactly is what I was looking for. It works! thx – Uwe Heim Jul 10 '14 at 14:58
  • @UweHeim Np, glad I could help. – Double A Jul 10 '14 at 15:17

I figured a working interim approach. But I'm only half happy with it...

Having to following nesting:

apex:page > apex:form > apex:pageBlock > apex:pageBlockTable > apex:pageBlockTable > apex:column > apex:outputField

I marked the column with a class

<apex:column styleClass="noInlineEdit" >

Then, after the DOM is loaded, I do remove the inline-editing mechanism like this:

    window.setTimeout( function(){ 
        $(".noInlineEdit .inlineEditWrite span").unwrap();
    }, 1000);

It's not good, it's not nice, it's hackish, but works. Better solutions are highly appreciated, because I'm looking for an reusable pattern.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.