function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PuranKishorePuranKishore 

How to pass the message for phone, website in application form when we save the file

<apex:page controller="AccountExample1" showHeader="true" action="{!ActionToDo}">
    <apex:form >
        <apex:sectionHeader title="New Account" subtitle="Edit Account" />
        
        <apex:pageBlock title="Account Edit" mode="Edit">
            
                <apex:pageBlockSection title="Account Information">
                    <apex:outputField value="{!acc.ownerID}"/>
                    <apex:inputField value="{!acc.Rating}"/>
                    <apex:inputField value="{!acc.Name}"/>
                    <apex:inputField value="{!acc.Phone}"/>
                    <!--<apex:inputField value="{!acc.Parent}"/>-->
                    <apex:inputField value="{!acc.Fax}"/>
                    <apex:inputField value="{!acc.AccountNumber}"/>
                    <apex:inputField value="{!acc.Website}"/>
                    <apex:inputField value="{!acc.Site}"/>
                    <apex:inputField value="{!acc.TickerSymbol}"/>
                    <apex:inputfield value="{!acc.Type}"/>
                    <apex:inputField value="{!acc.OwnerShip}"/>
                    <apex:inputField value="{!acc.Industry}"/>
                    <apex:inputfield value="{!acc.NumberOfEmployees}"/>
                    <apex:inputfield value="{!acc.AnnualRevenue}"/>
                    <apex:inputField value="{!acc.sic}"/>
                    <apex:inputField value="{!acc.Account_Email__c}" />
                    <apex:inputField value="{!acc.Count_Contacts__c}"/>
                    
                </apex:pageBlockSection>     
                <apex:pageBlockSection title="Account Information" >
                    <apex:inputTextarea value="{!acc.BillingStreet}"/>
                    <apex:inputTextarea value="{!acc.ShippingStreet}"/>
                    <apex:inputField value="{!acc.BillingCity}"/>
                    <apex:inputField value="{!acc.ShippingCity}"/>
                    <apex:inputfield value="{!acc.BillingState}"/>
                    <apex:inputField value="{!acc.ShippingState}"/>
                    <!--<apex:inputField  value="{!acc.BillingZip}"/>-->
                    <!--<apex:inputField value="{!acc.ShippingZip}"/>-->
                    
                
                </apex:pageBlockSection>
            <apex:pageBlockSection title="Account Information">
                <apex:inputfield value="{!acc.CustomerPriority__c}"/>
                <apex:inputField value="{!acc.SLA__c}"/>
                <apex:inputField value="{!acc.SLAExpirationDate__c}"/>
                <apex:inputField value="{!acc.SLASerialNumber__c}"/>
                <apex:inputField value="{!acc.NumberofLocations__c}"/>
                <apex:inputField value="{!acc.UpsellOpportunity__c}"/>
                <apex:inputField value="{!acc.Active__c}"/>
            
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Description Information">
                <apex:inputtextarea value="{!acc.Active__c}"/ >
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
            <apex:commandButton value="Save" action="{!Save}" />
            </apex:pageBlockButtons>
        </apex:pageBlock>
    
    </apex:form>
</apex:page>

 

 

 

 

 

public class AccountExample1
{
    public void Save() {
     //acc = new Account();
        insert acc;
    }

    public AccountExample1()
    {
       
        //acclist = [Select * from Account];
    }
    
    public Account acc{set;get;}
    //public List<Account> acclist{set;get;}
    public void ActionToDo()
    {
    }
}

ManjunathManjunath

Hi,

 

If am correct, you want to insert new account record into the database using the visualforce page. Then in your controller's constructor create an instance of the account object. See the below code (AccountExample1() constructor.).

 

public class AccountExample1
{
    public void Save() {
     //acc = new Account();
        insert acc;
    }

    public AccountExample1()
    {
       acc= new Account();
        //acclist = [Select * from Account];
    }
    
    public Account acc{set;get;}
    //public List<Account> acclist{set;get;}
    public void ActionToDo()
    {
    }
}

 

Regards,

 

 

davidjgriffdavidjgriff
If you are just creating a simple Account entry form, why bother with a custom controller? Just use the standard controller and no Apex is needed.