You need to sign in to do that
Don't have an account?
Public "registration" page for people to register
Hello the the glorious community.
I'm trying to create a PUBLIC (no login required) visualforce form for a person to submit information about themselves, then post the information they provide into a custom object. So far the great posts on this site have been very helpful for me to get started and I've got a somewhat working model. But...
I have a few questions:
1 - When I enter data into the form properly and submit, I'm not redirected to www.google.com - why? and how can I fix it
2 - When I do not enter data into the form properly (e.g. Zip and State are required), nothing seems to happen - any idea what's going on?
3 - If I try to browse to the public website whilst not logged into my SFDC instance, I am unable to submit or fill out any of the form fields - What do I need to change to make this fully public?
Thanks in advance for any help! (PS - I'm a newbie in all visualforce, APEX, and web development!)
I setup a class to control the submit form:
---------------------------------------------------------
public with sharing class Registration{
public List<Registration__c> Registration {get; set;}
public Registration(){
Registration = new List<Registration__c>();
Registration.add(new Registration__c());
}
public PageReference Submit(){
insert Registration;
PageReference home = new PageReference('http://www.google.com');
home.setRedirect(False);
return home;
}
}
--------------------------------------------------------
Next I build a visualforce page to with input fields to submit information:
-------------------------------------------------------
<apex:page standardStylesheets="false" showHeader="false" sidebar="false" controller="Registration">
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="Submit" action="{!Submit}" rerender="error"/>
</apex:pageBlockButtons>
<apex:PageBlockTable value="{!Registration}" var="a" id="table">
<table border="1">
<apex:column >
First Name<apex:inputField Label="First Name" value="{!a.First_Name__c}"/>
Last Name<apex:inputField Label="Last Name" value="{!a.Last_Name__c}"/>
Phone Number<apex:inputField Label="Phone Number" value="{!a.Phone_Number__c}"/>
Street Address<apex:inputField Label="Street Address" value="{!a.Street_Address__c}"/>
City<apex:inputField Label="City" value="{!a.City__c}"/>
State<apex:inputField Label="State" required="TRUE" value="{!a.State__c}"/>
Zip<apex:inputField Label="Zip Code" required="TRUE" value="{!a.Zip__c}"/>
</apex:column>
</table>
</apex:PageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>