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
vagishvagish 

Inline vf page issue

Hi all,

 

Is there any way to show inline visualforce page in edit mode as well?

Like if I have an object "Recipe", now for recipe preperation steps,   I am using inline vf page. Once the steps are enterd, now if that recipe is in edit mode, then inline vf page is not showing.

 

Thanks in advance!

bob_buzzardbob_buzzard

Unfortunately not.  The nearest you can get to this is using inline editing on the detail page.

vagishvagish

hi Bob,

 

For preparation steps, i have generated input type text via java script, how to enable inline editing for these text boxes?

bob_buzzardbob_buzzard

I am talking about inline editing on the main detail page, not in your inline visualforce page.

 

You can only include visualforce pages in the view page, so if you wanted to allow the capability to edit a record while displaying your VF page, you would need to use inline editing.

Chamil MadusankaChamil Madusanka

Hi All,

 

I have some code for inline editing in visualforce page. I will post the example code for Contact object. It will work with custom objects as well.

 

Visualforce page

 

<apex:page sidebar="false" controller="InlineController"> 
    
  <!--  <apex:sectionHeader title="Edit Employees" subtitle="{!$User.FirstName} {!$User.LastName}"/>-->
    <p/>
    
    <apex:pageMessages />
    <apex:form >    
    
    <apex:actionFunction name="saveEdit" action="{!saveEdit}"/>
    
 
    
    <apex:pageBlock >
    <apex:outputPanel id="contactList">
    <table>
        <tr>
            <th style="width:40px"> </th>
            <th style="width:40px"> </th>
            <th style="width:90px">Last Name</th>
            <th style="width:90px">Email</th>
            <th>Mailing Country</th>
        </tr>
        <apex:repeat value="{!employees}" var="e">
        <tr style="height:20px">
            <apex:outputPanel id="editRow" layout="none" rendered="{!e.Id == editContact.Id}">
                <td><apex:commandLink action="{!cancelEdit}" rerender="contactList">Cancel</apex:commandLink></td>
                <td><apex:commandLink action="{!saveEdit}" rerender="contactList">Save</apex:commandLink></td>
                <td><apex:inputField rendered="{!e.Id == editContact.Id}" value="{!editContact.LastName}"/></td>
                <td><apex:inputField rendered="{!e.Id == editContact.Id}" value="{!editContact.email}"/></td>
             <td><apex:inputField rendered="{!e.Id == editContact.Id}" onkeypress="if (event.keyCode == 13) saveEdit()" value="{!editContact.MailingCountry}"/></td>
            </apex:outputPanel>
            <apex:outputPanel id="viewRow" layout="none" rendered="{!e.Id != editContact.Id}">
                <td>
                    <apex:commandLink action="{!del}" onclick="return confirm('Are you sure you want to delete this Employee?')">Del
                        <apex:param name="delid" value="{!e.Id}"/>
                    </apex:commandLink>
                    
                </td>
                <td>
                    <apex:commandLink action="{!editcon}" rerender="employeeList">Edit <apex:param name="editid" value="{!e.id}"/>
                    </apex:commandLink>
                </td>
                <td>{!e.LastName}</td>
                <td>{!e.email}</td>
                <td>{!e.MailingCountry}</td>
            </apex:outputPanel>
        </tr>
        </apex:repeat>
    </table>
    </apex:outputPanel>
    </apex:pageBlock>

    </apex:form>
    
</apex:page>

 

controller

 

public class InlineController {


    public InlineController(ApexPages.StandardController controller) {
    
    }

   public Contact newContact { get; set; }
    
    public Contact editContact { get; set; }

    public InlineController () {
        newContact = new Contact();
    }
    
    public Contact[] getEmployees() {
        return [Select c.MailingCountry, c.LastName, c.Id, c.Email From Contact c];
    }
    
    public String getParam(String name) {
        return ApexPages.currentPage().getParameters().get(name);   
    }
    
        
    public PageReference del() {
        try {
            String delid = getParam('delid');
            Contact employee = [SELECT Id FROM Contact WHERE ID=:delid];
            DELETE employee;
        } catch (Exception e) {
            ApexPages.addMessages(e);
        }
        return null;
    }
    
    public PageReference editcon() {
        String editid = getParam('editid');
        editContact = [SELECT Name, LastName, email,MailingCountry FROM Contact WHERE id=:editid];
        return null;
    }
    
    public PageReference cancelEdit() {
   // System.Debug('GETURL ::: '+ApexPages.currentPage().getUrl());
        editContact = null;
        return null;
    }
    
    public PageReference saveEdit() {
        try {
            UPDATE editContact;
            editContact = null;
        } catch (Exception e) {
            ApexPages.addMessages(e);
        }
        return null;
    }

}

 

 

Try with this.

 

No more unfortunate for inline editing on visualforce pages :smileyhappy:

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

 

 

DeepakKapoor81DeepakKapoor81

Hi Bob,

 

Can you please let us know If using salesforce app on mobile would load inline VF on save a record...?

 

If not Is there any workaround there for this?

 

Thanks in advance

would love your inputs on this..

nallurisivashankarnallurisivashankar
Hi,
I have created visualforce page for Account using standard controller. after that i created new page layout for Account then dragged the visualforce page but i am facing a problem that i not getting the fields in the visualforce page to drag the fields.
what is the problem.???

thanks in advance....