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
scottj2scottj2 

Component Controllers with Save methods

Help!!

It looks like the Summer 2012 release broke something on a bunch of our apex component pages.

We have component pages with simple forms that can save data (usually custom fields on standard objects).  So for example, we have a "Billing" component which cantains a form where users can save Billing Information on an account.

The component looks like this:

 

<apex:component controller="billingController" allowDML="true" >
  
<apex:attribute name="acc"
description="The account"
type="Account"
required="true"
assignTo="{!acc}"/>
<apex:form >
       <apex:pageBlock title="Account Banking Info" mode="edit" id="thePageBlock">
                <apex:messages styleClass="errorMsg"  />
        <apex:pageBlockButtons >
            <apex:commandButton action="{!save}" value="Save" disabled="false" />
        </apex:pageBlockButtons>
.....{all the form fields are here}......
</apex:form>

 


Then, our component controller (billingController.class), has a simple save method:

    public void save() {
      try{
       upsert(this.acc);
      } catch(DMLException ex) {
       ApexPages.addMessages(ex);
      }
      return;
    }

 



This code has worked without issue for over a year now.  Then, this morning after the 2012 summer release, this page does not work.  No error message is retrieved, and when I look in the debug logs, the save method is never called.  Our tests work fine, since they call the save method directly, but the component pages are never calling the method definied in the action attribute of the commandbutton.  I have also confirmed that this is broken for each and every one of our component pages.  We also have apex pages that also do save calls in the identical way, and those pages seem to work fine.  It only looks like it's broken for apex components.

Any ideas whats going on?

scottj2scottj2

Update:

 

Looks like it has something to do with where the apex:form tag is placed.  If I place it inside the component, it breaks.  If it's on the page, it works fine.

 

Obviously we want the form tag to be part of the component, not the page.