I want to save the fields BillingAddress, ShippingAddress and a custom field "FiscalAddress"
I understand that the API only have BillingAddress and ShippingAddress and I need one more.
I want insert in database (SOQL) but the logic of my script is wrong.
What corrections you should do to insert the input text fields in the Account table?
error console:
<apex:inputField>
value binding '{!a.BillingStreet}'.<apex:inputField>
can only be used with SObjects, or objects that are Visualforce field component resolvable.
Markup
<apex:page Controller="CustomAccount" >
<apex:form >
<apex:pageBlock title="Edit Contact">
<apex:pageBlockSection columns="1">
<apex:inputField value="{!a.BillingStreet}"/>
<apex:inputField value="{!a.BillingCity}"/>
<apex:inputField value="{!a.BillingState}"/>
<apex:inputField value="{!a.BillingPostalCode}"/>
<apex:inputField value="{!a.ShippingStreet}"/>
<apex:inputField value="{!a.ShippingCity}"/>
<apex:inputField value="{!a.ShippingState}"/>
<apex:inputField value="{!a.ShippingPostalCode}"/>
<apex:inputField value="{!a.FiscalStreet}"/>
<apex:inputField value="{!a.FiscalCity}"/>
<apex:inputField value="{!a.FiscalState}"/>
<apex:inputField value="{!a.FiscalPostalCode}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Code
public with sharing class CustomAccount {
public Account a { get; set; }
public List<Account> samepage { get; set; }
public CustomAccount(){
a = new Account();
}
public PageReference save() {
insert a;
}
}
Markup new version
<apex:page standardController="Account">
<apex:form>
<apex:pageBlock>
<apex:pageBlockSection>
<apex:inputField value="{!Account.BillingStreet}" />
<apex:inputField value="{!Account.BillingCity}" />
<apex:inputField value="{!Account.BillingState}" />
<apex:inputField value="{!Account.BillingPostalCode}" />
<apex:inputField value="{!Account.ShippingStreet}"/>
<apex:inputField value="{!Account.ShippingCity}"/>
<apex:inputField value="{!Account.ShippingState}"/>
<apex:inputField value="{!Account.ShippingPostalCode}"/>
<apex:inputField value="{!Account.FiscalStreet__c}" />
<apex:inputField value="{!Account.FiscalCity__c}"/>
<apex:inputField value="{!Account.FiscalState__c}"/>
<apex:inputField value="{!Account.FiscalPostalCode__c}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons>
<apex:commandButton action="{!save}" value="Save" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>