• vihio
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

I put together a little estimate form so people can submit their projects to this company and get a reply with pricing and time and things like that.

 

Well I found out quite quickly that you need to write a custom controller/extension to allow public users get their data submitted into force.com. well I can't for the life of me get this to work with my extension. keep in mind I'm a teen and this is my first time developing with apex so don't start flaming me because of my so so code haha

 

my extension:

 

public class EstimateExtension
{
    public String getEstimate() {
        return null;
    }
    public PageReference save() {
        return null;
    }
   public Estimate__c estimate {get; private set;}

    public EstimateExtension
(ApexPages.StandardController stdController) {
estimate = (Estimate__c)stdController.getRecord();
}
    public EstimateExtension () 
    {
         Id id = ApexPages.currentPage().getParameters().get('id');
         estimate = (id == null) ? new Estimate__c() : [SELECT First_Name__c, Last_Name__c, Title__c, 
         Your_Company__c, URL__c, Your_Email__c, Primary_Number__c, Your_Budget__c, 
         What_Services_Are_You_Interested_In__c, If_Others__c, Tell_Us_About_Your_App__c, About_Us__c, Message__c  
         FROM Estimate__c WHERE id = :id];
    }
    
    public PageReference saveApplication() {
       try {
           upsert(estimate);
       } catch(System.DMLException e) {
            ApexPages.addMessages(e);
            return null;
        }
        estimate = new Estimate__c();

        return (new ApexPages.StandardController(estimate)).view();
    }
    
    
}

 

EDIT: If it helps or matters, I am a free user. I do not pay for the live site

  • August 09, 2010
  • Like
  • 0

I put together a little estimate form so people can submit their projects to this company and get a reply with pricing and time and things like that.

 

Well I found out quite quickly that you need to write a custom controller/extension to allow public users get their data submitted into force.com. well I can't for the life of me get this to work with my extension. keep in mind I'm a teen and this is my first time developing with apex so don't start flaming me because of my so so code haha

 

my extension:

 

public class EstimateExtension
{
    public String getEstimate() {
        return null;
    }
    public PageReference save() {
        return null;
    }
   public Estimate__c estimate {get; private set;}

    public EstimateExtension
(ApexPages.StandardController stdController) {
estimate = (Estimate__c)stdController.getRecord();
}
    public EstimateExtension () 
    {
         Id id = ApexPages.currentPage().getParameters().get('id');
         estimate = (id == null) ? new Estimate__c() : [SELECT First_Name__c, Last_Name__c, Title__c, 
         Your_Company__c, URL__c, Your_Email__c, Primary_Number__c, Your_Budget__c, 
         What_Services_Are_You_Interested_In__c, If_Others__c, Tell_Us_About_Your_App__c, About_Us__c, Message__c  
         FROM Estimate__c WHERE id = :id];
    }
    
    public PageReference saveApplication() {
       try {
           upsert(estimate);
       } catch(System.DMLException e) {
            ApexPages.addMessages(e);
            return null;
        }
        estimate = new Estimate__c();

        return (new ApexPages.StandardController(estimate)).view();
    }
    
    
}

 

EDIT: If it helps or matters, I am a free user. I do not pay for the live site

  • August 09, 2010
  • Like
  • 0
Sorry if this is way too basic but I've been pouring over all of the books I got at dreamforce and the online docs and cannot figure this out.

I'm creating a Visualforce page for a custom object called "Override".  At minimum I'd like the user to be able to insert an Override record on this page (in one row).  However, all I can see in the docs is how to create a page that displays existing records and perform mass updates to them:

Code:
<apex:page standardController="Override__c" recordSetVar="overrides">
<apex:sectionHeader title="Overrides"></apex:sectionHeader>
    <apex:form >
        <apex:pageBlock id="pageRowInsert">
        <apex:pageMessages />
            <apex:pageBlockButtons >
                <apex:commandButton action="{!Save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!overrides}" var="ovr">
               <apex:column ><apex:inputField value="{!ovr.Advisor_Rep__c}"  /></apex:column>
                <apex:column ><apex:inputField value="{!ovr.Institution__c}"  /></apex:column>
                <apex:column headerValue="Opportunity" value="{!ovr.Opportunity__c}"></apex:column>
                <apex:column headerValue="Override Amount" value="{!ovr.Override_Amount__c}"></apex:column>               
            </apex:pageBlockTable>
        </apex:pageBlock>
   </apex:form>
</apex:page>

How do I tell the system that I want empty  inputFields so that I can Insert a record?

And if it's not too much to ask, what I'd really want is for the user to be able to have 10 or 20 empty rows so they could setup 10 to 20 records at one time then press "SAVE" once and have all of them inserted.