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
Nickname_BravoNickname_Bravo 

Update Opportunity with Force.com Site From

I don't know why, but my force.com site is not updating my opportunity when I go to it and try and update a "survey" we send.

 

The data populates on the page correctly just doesn't get sent to the opportunity on submission.

 

Here's the controller I am using:

 

public class OpptyCont {
public Opportunity opportunity{ get
        {
        opportunity = [SELECT Id, Name ,X1__c,X2__c,X3__c,X4__c,X5__c,X6__c,X7__c,X8__c,X9__c FROM Opportunity
                WHERE Id = :ApexPages.currentPage().getParameters().get('Id')];
        return opportunity;
        }
             set;
    } 

    public OpptyCont() {
    }


     public PageReference save() {
     try{
           update opportunity;
        }catch(System.DMLException e) {
            ApexPages.addMessages(e);
            return null;
        }
        return null;
    }
   
}

 

Here's the Apex Page:

 

<apex:page Controller="OpptyCont" showHeader="false" sidebar="false">

   <apex:pageBlock title="Survey Questions for {!Opportunity.Name}">
      <b>Please fill out the following Questions:</b>
   </apex:pageBlock>
 <apex:form >
 <br></br>
 <b>1.</b><apex:outputField value="{!Opportunity.X1__c}"/>
 <br></br>
 <br></br>
 <apex:inputTextarea label="{!Opportunity.X1__c}" value="{!Opportunity.X1__c}" id="X1__c" style="width:80%" />
 <br></br>
 <br></br>
<b> 2.</b><apex:outputField value="{!Opportunity.X2__c}"/><br></br>
 <apex:inputTextarea label="{!Opportunity.X2__c}" value="{!Opportunity.X2__c}" id="X2__c" style="width:80%" />
<br></br>
<br></br>
 <b>3.</b><apex:outputField value="{!Opportunity.X3__c}"/><br></br>
 <apex:inputTextarea label="{!Opportunity.X3__c}" value="{!Opportunity.X3__c}" id="X3__c" style="width:80%" />
<br></br>
<br></br>
 <b>4.</b><apex:outputField value="{!Opportunity.X4__c}"/><br></br>
 <apex:inputTextarea label="{!Opportunity.X4__c}" value="{!Opportunity.X4__c}" id="X4__c" style="width:80%" />
<br></br>
<br></br>
 <b>5.</b><apex:outputField value="{!Opportunity.X5__c}"/><br></br>
 <apex:inputTextarea label="{!Opportunity.X5__c}" value="{!Opportunity.X5__c}" id="X5__c" style="width:80%" />
<br></br>
<br></br>
 <b>6.</b><apex:outputField value="{!Opportunity.X6__c}"/><br></br>
 <apex:inputTextarea label="{!Opportunity.X6__c}" value="{!Opportunity.X6__c}" id="X6__c" style="width:80%" />
<br></br>
<br></br>
 <b>7.</b><apex:outputField value="{!Opportunity.X7__c}"/><br></br>
 <apex:inputTextarea label="{!Opportunity.X7__c}" value="{!Opportunity.X7__c}" id="X7__c" style="width:80%" />
<br></br>
<br></br>
 <b>8.</b><apex:outputField value="{!Opportunity.X8__c}"/><br></br>
 <apex:inputTextarea label="{!Opportunity.X8__c}" id="X8__c" style="width:80%" />
 
<br></br>
<br></br>
   <apex:commandButton value="Submit" action="{!save}" />
</apex:form>
</apex:page>

 

If you can point me in the right direction that would be great.