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
klabklab 

actionSupport with <apex:detail> tab with inlineEdit set to true

Has anyone ever used actionSupport with the <apex:detail> tag when inlineEdit is set to true? I'm having trouble running the method in the action attribute.  It doesn't seem to ever want to run.  Code sample below. I've used both "onsubmit" and "onchange" with no results.  If any rerender attribute is in there, it just calls the getter and I don't see any debug "testing" line.
<apex:page standardController="Opportunity" extensions="conExt" tabStyle="Opportunity" title="Opportunity: {!opportunity.name}">
    <apex:pageMessages />
       <chatter:feedWithFollowers entityId="{!opportunity.id}"/>
       <apex:form >
        <apex:pageBlock mode="mainDetail" id="theBlock">
            <apex:pageBlockSection showHeader="true" columns="2" collapsible="true">
                <apex:outputField value="{!theObject.text__c}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
        <apex:detail subject="{!opportunity.id}" relatedList="true" title="true" inlineEdit="true">
             <apex:actionSupport event="onsubmit" action="{!sampleMethod}" />
        </apex:detail>
    </apex:form>
</apex:page>
 
public class conExt{

    //VARIABLES
    public sObject theObject;
    public Id objectId {get;set;}
      
    //CONSTRUCTOR
    public conExt(ApexPages.StandardController stdCon){
        //default values
        this.objectId = stdCon.getId();
        this.theObject = stdCon.getRecord();   
       
    }

    public sObject getTheObject(){
        sObject testObj = [Select Id, text__c from Opportunity where Id = : objectId];
        
        return testObj;
    }    

    public void sampleMethod(){
        system.debug('*****testing');
    }
}

Thank  you,

Klab
bob_buzzardbob_buzzard
When you double click to inline edit, that doesn't create an input that is bound to the record in your controller via the viewstate, rather it creates a decoupled input on the fly and renders a save button that can save the record via a javascript call to sfdcPage.save().

You could attach some javascript to your Visualforce save button that locates the inline edit save button and if that exists, clicks it. You'd need to be able to detect that the save has completed and then complete your own save though, which I can only see happening by periodically checking for the inline edit save button disappearing. Also, if you were carrying out a save on the same record with other changes from your visualforce page, you'd need to retrieve the record anew from the database and merge your changes in. Add the fact that if the way that inline editing works were to change then your solution would suddenly stop working, and it doesn't look like a robust solution.

The actionsupport allows you to execute server side actions in response to JavaScript events, such as onclick, mouseover etc, rather than interact with the inline editing capability.
klabklab
You know what's like seeing Superman in real life? Having Bob Buzzard reply to your question! Thanks a lot for the tip and the advice. Big fan of your blog. I don't necessarily like the <apex:detail> tag, but lots of declarative users love the drag and drop management of a page layout, so I ventured about as far as I could in my example.  My end result would not include it, but where we've landed is using it together with some markup that provides a proactive response to editing a record versus retroactive. Inline VF just wasn't going to cut it with that set height and inability to update non <apex:detail> elements after an inline edit event.   Thanks BB!
bob_buzzardbob_buzzard
You are too kind :)