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
Lago S.p.a.Lago S.p.a. 

Update record in public force.com sites

Hi, I have serios problem about this visualforce and I can't figure it out :(.
It must be published on a public site, for making a customer to update a custom object.
The visualforce runs correctly and the record is saved when modified, but on the force.com site I have this error:
core.apexpages.exceptions.ApexPagesGenericException: system.security.NoAccessException:Accesss in update denied for DealerContact__c, Controller action methods may not be executed.

Here is my visualforce controller:
<apex:page docType="html-5.0" showHeader="false" Controller="DealerContactController">
    <apex:variable value="{!contacts}" var="ct"/>
    <apex:define name="Header">
        <h3 class="slds-section-title--divider">Contact List</h3>
    </apex:define>
    <apex:slds />
    <div class= "slds-scope">
        <div class="slds-grid slds-wrap slds-align_absolute-center">
            <div class="slds-col slds-size--4-of-4 slds-small-size--1-of-4 slds-medium-size--3-of-4">
                <!-- Contacts List -->
                <apex:form id="myform">
                     <apex:messages />
                    <apex:repeat value="{!contacts}" var="ct" rendered="true">
                        <apex:pageBlock >
                            <apex:pageBlockSection >
                                <apex:inputText styleClass="slds-input slds-align_absolute-center" value="{!ct.first_name__c}" />
                                <!--<apex:inputText styleClass="slds-input slds-align_absolute-center" value="{!ct.LastName}"/> -->
                                <apex:inputText styleClass="slds-input" value="{!ct.Email__c}" />
                                <apex:selectList styleClass="slds-input" value="{!ct.Type__c}" size="1">
                                    <apex:selectOptions value="{!Items}" rendered="true" />
                                </apex:selectList>
                                 <!--<apex:pageBlockSectionItem >
                                     <apex:outputLabel value="{!$ObjectType.Contact.fields.type__c.label}" />
                                    <apex:selectList styleClass="slds-input"  value="{!options}"   size="1">
                                        <apex:selectOptions value="{!Items}" rendered="true"/>
                                    </apex:selectList> 
                                </apex:pageBlockSectionItem> -->    
                            </apex:pageBlockSection>
                        </apex:pageBlock>
                    </apex:repeat> 
                    <div class="slds-is-relative position=central">
                       <apex:commandButton styleclass="slds-align_absolute-center slds-button slds-button_brand" value="Press here to Save" action="{!save}" />
                        <input type="Button" value="submit" action="doAction()"/>
                        <apex:actionFunction name="doAction" action="{!save}" rerender="myform"/>
                    </div>
                       
                    <!--<apex:commandButton styleClass="slds-button slds-button--brand slds-button--neutral slds-not-selected" value="Cancel" action="{!cancel}"/>
<apex:commandButton styleClass="slds-button slds-button--brand slds-button--neutral slds-not-selected" value="Edit" action="{!edit}"/>                                                        
-->    
                </apex:form>
            </div>
        </div>
    </div>
</apex:page>

and its controller
//DEALERCONTACT CONTROLLER////////////////
//CLASS
public without sharing class DealerContactController {
    public DealerContact__c contact {get;set;}//new DealerContact__c();
    public List<DealerContact__c> contacts {get;set;}//new List<DealerContact__c>();
    public List<SelectOption> options {get;set;}
    public List<SelectOption> statusOptions {get;set;}
    public string defaultOption {get;set;}
    public string defaultvalue{get;set;}
    //CONSTRUCTOR
    public DealerContactController() {
        contacts = [select ID,First_Name__c ,type__c, email__c from 
                    DealerContact__c order by First_Name__c  limit 10];
        system.debug(contacts);
        statusOptions = new List <SelectOption>();
        List<Schema.Picklistentry> entries = Schema.DealerContact__c.type__c.getDescribe().getPicklistValues();
        //opt = contact.type__c;
        // For each picklist value, a new select option created
        for (Schema.Picklistentry entry: entries) {
            statusOptions.add(new SelectOption(entry.getValue(), entry.getLabel()));
            //check default value and assign
            //}
        }
    }
    //GETTER METHOD
    public List<DealerContact__c> getContacts(){
        List<DealerContact__c> result = [select ID,First_Name__c ,type__c, email__c from 
                    DealerContact__c order by First_Name__c  limit 10];
        system.debug(result);
        return result;
    }
    //SAVE METHOD #1
    public pagereference save(){
        update contacts;
        //return apexpages.currentpage();
        return null;
    }
}

Any help will be appreciated.
Thanks in advance.