I have a Visualforce page which successfully submits a form. But I made a public facing page using "Sites" in Setup and that one is failing. In the VF page I am taking values from a visible form and plugging them into a hidden apex form (because apex forms are ugly).
When I look at the visualforce page in my org (at the link https://tractionondemand--bttom--c.cs62.visual.force.com/apex/CSATSurvey?pid=a8q5C000000L2m3QAC&cid=0035C00000G4n14QAB
) the apex form is generating. I can tell because I temporarily took off the "hidden"
class. But on the public site (which uses that same VF page) the apex form is not showing and I get an error when trying to submit.
VF page (works properly):
Public Site (does not display the apex:form):
VF page form code:
<apex:form styleClass="">
<!-- Values will be copied from prettier form above -->
<apex:inputText id="couldDoBetter" value="{!survey.What_can_Traction_do_even_better__c}"/>
<apex:inputText id="didReallyWell" value="{!survey.What_did_traction_do_really_well__c}"/>
<apex:inputText id="additionalComments" value="{!survey.Additional_Comments__c}"/>
<apex:inputText id="recommendChance" value="{!survey.Likelihood_of_recommending_Traction__c}"/>
<apex:inputText id="documentation" value="{!survey.Documentation_was_clear_and_thorough__c}"/>
<apex:inputText id="objectiveAchievement" value="{!survey.The_objectives_were_met__c}"/>
<apex:inputText id="objectiveClarity" value="{!survey.The_objectives_were_clearly_defined__c}"/>
<apex:inputText id="teamResponsiveness" value="{!survey.Inquires_were_answered_in_timely_manner__c}"/>
<apex:inputText id="training" value="{!survey.User_training_was_effective__c}"/>
<apex:inputText id="communication" value="{!survey.The_communication_was_consistent__c}"/>
<!-- Filled in from url parameters -->
<apex:inputText id="projectId" value="{!survey.Project__c}"></apex:inputText>
<apex:inputText id="contactId" value="{!survey.Recipient__c}"></apex:inputText>
<!-- Used to submit hidden form to salesforce -->
<apex:commandButton id="salesforceSubmitButton" action="{!save}" value="Save"/>
<script>
console.log('form loaded...');
// Make the hidden form fields and button accessable by javascript (IDs are generated)
var additionalCommentsFieldId = '{!$Component.additionalComments}';
console.log('additionalCommentsFieldId: ' + additionalCommentsFieldId);
var couldDoBetterFieldId = '{!$Component.couldDoBetter}';
var didReallyWellFieldId = '{!$Component.didReallyWell}';
var recommendChanceFieldId = '{!$Component.recommendChance}';
var documentationFieldId = '{!$Component.documentation}';
var objectiveAchievementFieldId = '{!$Component.objectiveAchievement}';
var objectiveClarityFieldId = '{!$Component.objectiveClarity}';
var teamResponsivenessFieldId = '{!$Component.teamResponsiveness}';
var trainingFieldId = '{!$Component.training}';
var communicationFieldId = '{!$Component.communication}';
var salesforceSubmitButtonId = '{!$Component.salesforceSubmitButton}'
</script>
</apex:form>