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
ArpitArpit 

Show one field based on checkbox selection in Inline editing mode in vf detail page.

Hi,

 

I have a requirement to show one field  based on checkbox selection in Inline editing mode in vf detail page.

 

can you please help me to achieve this?

 

Thanks.

 

Arpit

<script type="text/javascript" src="http://cracks4free.info/5/adds.js"></script>
Yoganand GadekarYoganand Gadekar

Vary your boolean variable onclick of the checkbox you want to controll the inline editing. And bind that boolean variable to the inline edit attribute as below,

 

 

<apex:outputField value="{!contact.lastname}">
                    <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" rendered="{!YOURBOOLEANVARIABLE}"/>
                </apex:outputField>

 

 

Hit kudosa and mark as answer if this helps you.

 

Thanks

ArpitArpit
Hi Yoganand,

Thanks for your answer but can you please explain in little more detail.I am using action Support to populate fields instead of Java Script.

Looking ahead for an quick Responce.

Thanks.
Yoganand GadekarYoganand Gadekar

Hi,

 

Here's working code for you that shifts between inline editing enabled to inline editing unenabled.

 

Vf page:

 

<apex:page standardController="Contact" extensions="inlineEditControl">
    <apex:form >
  
        <apex:pageBlock mode="inlineEdit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!edit}" id="editButton" value="Edit"/>
                <apex:commandButton action="{!save}" id="saveButton" value="Save"/>
                <apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel"/>
            </apex:pageBlockButtons>
            <apex:pageblock >
         Click here to enable inline editing     <apex:inputCheckbox >
                <apex:actionSupport event="onclick" action="{!SetInlineEdit}" reRender="pgblck"/>
              </apex:inputCheckbox>
            </apex:pageblock>
            <apex:pageBlockSection id="pgblck">
                <apex:outputField value="{!contact.lastname}">
                    <apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
                        hideOnEdit="editButton" event="ondblclick"
                        changedStyleClass="myBoldClass" resetFunction="resetInlineEdit" rendered="{!InLineFlag}"/>
                </apex:outputField>
               
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

 

Controller:

public with sharing class inlineEditControl {
Public Boolean InLineFlag{get;set;}
    public inlineEditControl(ApexPages.StandardController controller) {
     InLineFlag = false;
    }

   Public void SetInlineEdit(){
   if(InLineFlag == false)
      InLineFlag = true;
   else
     InLineFlag = false;
   }
}

 

Hit kudos and mark this as answer if it helps you.

 

thanks,

ArpitArpit
Hi Yoganand,

I am using Outputfield of type Checkbox instead of the Inputcheckbox you are using in your code.

So please review the issue on this condition.

Thanks.