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
MehaMeha 

Insert record into custom object using Site.com Visualforce Page

Hi,

 

I want to insert data into my custom object customer_details. The code runs perfectly if I run the visualforce page, i.e. at https://ap1.salesforce.com/apex/insert1 

but when I added this page to my site.com website, it does not display anything of the below code except my custom site template. Please help! 

 

Following is my code below:-

 

<apex:page id="Insert" showHeader="false" standardController="customer_details__c" title="Insert">
<apex:composition template="Template"></apex:composition>
<apex:define name="body">
<center>
<apex:panelGrid bgcolor="white" columns="1" style="border: 1px solid #E5E4E2;">
<br/>
<br/>
<apex:panelGrid width="758" cellpadding="0" cellspacing="0" bgcolor="white" columns="1" styleClass="topPanelContainer">
<br/>
<apex:outputPanel layout="block" styleClass="topPanel">
<apex:panelGrid width="758" cellpadding="0" cellspacing="0" bgcolor="white" columns="2" style="border: 1px solid #E5E4E2;">
<apex:image url="{!URLFOR($Resource.SiteSamples, 'img/clock.png')}"/>
<apex:panelGroup >
<br/>
<apex:outputText styleClass="title" value="{!$Label.site.user_registration}" style="font-weight:bold; font-size:15px;"/>
<br/>
<apex:form id="theForm" forceSSL="true">
<apex:pageMessages id="error"/>
<apex:panelGrid columns="2" style="margin-top:1em;">

<apex:outputLabel value="Community Name" for="Community_name__c"/>
<apex:inputText required="true" id="nickname" value="{!customer_details__c.Community_name__c}"/>
<apex:outputLabel value="Username" for="Username__c"/>
<apex:inputText required="true" id="username" value="{!customer_details__c.Username__c}"/>
<apex:outputLabel value="Password" for="Password__c"/>
<apex:inputSecret id="password" value="{!customer_details__c.Password__c}"/>
<apex:commandButton action="{!save}" value="Save record"/>
<apex:commandButton action="Cancel" value="Cancel"/>
<apex:outputText value=""/>

</apex:panelGrid>
</apex:form>
<br/>
</apex:panelGroup>
</apex:panelGrid>
</apex:outputPanel>
<c:SitePoweredBy />
</apex:panelGrid>
</apex:panelGrid>
</center>
<br/>
</apex:define>

</apex:page>

Best Answer chosen by Admin (Salesforce Developers) 
souvik9086souvik9086

Hi,

 

If it will work inside, it must work in site also. You can check in site public settings whether the object anf fields are visible or not. If not, yu can check the CRUD permissions there and see what happens.

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

All Answers

souvik9086souvik9086

Hi,

 

If it will work inside, it must work in site also. You can check in site public settings whether the object anf fields are visible or not. If not, yu can check the CRUD permissions there and see what happens.

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

This was selected as the best answer
MehaMeha

Thku so much! Now its working :) :)