I have created a web form with Visualforce pages and a Site page added to our website for visitors to contact us. After they submit, they get an Authorization Required message but their form is submitted correctly.

The user is using a Guest profile for the site.

What can I do to keep the User from getting this message?

Here is my visualforce page code:

             document.getElementById('{!$Component.ContactForm}').elements['{!$Component.hiddenField}'].value = 'Global Logistics & Supply Chain Mgmt Masters Page';

        <apex:inputHidden value="{!contact.Student_Status__c}" id="hiddenStatus"/>

             document.getElementById('{!$Component.ContactForm}').elements['{!$Component.hiddenStatus}'].value = 'Inquiry';

        <apex:inputHidden value="{!contact.First_Contact__c}" id="hiddenContact"/>

             document.getElementById('{!$Component.ContactForm}').elements['{!$Component.hiddenContact}'].value = 'Spring 2017';

  <!-- Button Section -->
  <apex:pageBlockButtons location="bottom">
    <apex:commandButton value="Submit" action="{!save}" />

  • 2
    Please edit your post to share your code here...you're likely causing a redirect to an authorized page. Simplest is to not redirect at all and instead rerender page messages (after adding conformation message). – Adrian Larson Mar 9 '17 at 22:50

It looks like you're using the standard controller. The standard controller save() method returns a redirect to the newly created record's detail page, which requires authentication. You'll need to write a custom controller or controller extension to resolve this, so you can define your own save behavior (redirect elsewhere, display a message on the current page, etc).

Here's a longer tutorial to walk you through the creation of a custom controller.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.