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
PremanathPremanath 

How to get Edit mode on VF page

Hi guys,

 

  I have a problem to get Edit mode in VF page.

  Here by using apex:Detail we will get inline Edit mode of the Total page.Like this

<apex:page standardController="Event">
<apex:form >
<apex:pageBlock >
<apex:detail inlineEdit="True" relatedList="true"/>
</apex:pageBlock>
</apex:form>
</apex:page>

 

   Now i want Edit mode with out using apex:inputfield , Is there any way to do it.

   Please let me know.

 

 

Thaks 

Prem

   

ManjunathManjunath

Hi,

 

Try enclosing the fields with <apex:inlineEditSupport > .

 

Regards,

Manjunath

PremanathPremanath

No use i want it in Edit mode

Thaks

HusseyHussey

Hi Premnath,

 

Modify your code as follows.

 

<apex:page standardController="Event" action="{!edit}">
<apex:form >
<apex:pageBlock >
<apex:detail inlineEdit="True" relatedList="true"/>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

PremanathPremanath

Thanks Hussy,

 

   Actually i need the same thing but different Requirement

   IT directly moves to the Detail page, it's not staying on VF page.

   In VF page page i need to give some conditions using class.

   Based on that i need to display Detail page, So in your code , is there possibility to give conditions

 

 

Thanks

Prem

Starz26Starz26

Premanath wrote:

Hi guys,

 

  I have a problem to get Edit mode in VF page.

  Here by using apex:Detail we will get inline Edit mode of the Total page.Like this

<apex:page standardController="Event">
<apex:form >
<apex:pageBlock >
<apex:detail inlineEdit="True" relatedList="true"/>
</apex:pageBlock>
</apex:form>
</apex:page>

 

   Now i want Edit mode with out using apex:inputfield , Is there any way to do it.

   Please let me know.

 

 

Thaks 

Prem

   


As far as I know, there is no way to do it.

 

You will have to create the edit page manually.

 

Not exactly sure of your use case as you are not doing anything custom with the page.

Saurabh DhobleSaurabh Dhoble

Premanath,

Your problem is still not 100% clear to me, but from what I understand you need to customize the "Edit" page for an object. For this, the only viable solution is to build the entire Edit page manually. It may sound daunting, but it is pretty easy. I can share with you the code that I wrote to create a custom contact edit page :-

 

<apex:page standardController="Contact" showHeader="false" showChat="false" sidebar="false">
    <apex:form >
    <apex:pageBlock mode="edit" title="Edit Contact">
        <apex:pageBlockButtons location="both">
        	<apex:commandButton value="Save" action="{!Save}"  />
        </apex:pageBlockButtons>
    	<apex:pageBlockSection title="Contact Information" columns="2" collapsible="true">
            <apex:inputField id="cName" value="{!Contact.Name}"/>
            <apex:inputField id="cAccount" value="{!Contact.Account.Name}"/>
            <apex:inputField id="cPhone" value="{!Contact.Phone}"/>
            <apex:inputField id="cHomePhone" value="{!Contact.HomePhone}"/>
            <apex:inputField id="cMobilePhone" value="{!Contact.MobilePhone}"/>
            <apex:inputField id="cTitle" value="{!Contact.Title}"/>
            <apex:inputField id="cOtherPhone" value="{!Contact.OtherPhone}"/>
            <apex:inputField id="cDepartment" value="{!Contact.Department}"/>
            <apex:inputField id="cBirthDate" value="{!Contact.BirthDate}"/>
            <apex:inputField id="cEmail" value="{!Contact.Email}"/>
            <apex:inputField id="cReportsTo" value="{!Contact.ReportsToId}"/>
            <apex:inputField id="cAssistantPhone" value="{!Contact.AssistantPhone}"/>
            <apex:inputField id="cLeadSource" value="{!Contact.LeadSource}"/>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Referred By"></apex:outputLabel>
            	<apex:inputField id="cReferredBy" value="{!Contact.Referred_By_Contact__c}" />
			</apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:pageBlockSection title="Address Information">
        	<apex:inputField id="cMailingStreet" value="{!Contact.MailingStreet}"/>        
            <apex:inputField id="cMailingCity" value="{!Contact.MailingCity}"/>        
            <apex:inputField id="cMailingState" value="{!Contact.MailingState}"/>        
            <apex:inputField id="cMailingCountry" value="{!Contact.MailingCountry}"/>        
            <apex:inputField id="cMailingPostalCode" value="{!Contact.MailingPostalCode}"/>        
        </apex:pageBlockSection>
    </apex:pageBlock>
    </apex:form>
</apex:page>

 

You can use a controller extension to then add whatever additional logic you want to add to render the record.

PremanathPremanath

Yes I did this way only,

There is no way to go ..