+ Start a Discussion
metal-headmetal-head 

problem with overrding "new" button with visualforce page

Hi Gurus,

 

I am facing problems with overriding "new" button.

 

We are using Professiona Edition. We needed a visualforce page in place of standard "new page".

 

So we created one, and replaced it. but when I am hitting save button, it has standard save function "{!save}", the new record is not being created and it is staying on the same page.

 

I tried to find out if PE allows such thing, and found out that it does allow.

 

Can you guys help me out.

 

i am trying to override standard oppotunity. the code is like this...

<apex:page standardController="opportunity" >
 
 <apex:form id="form00"  title="New Opportunity">
   <apex:pageBlock id="block01">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value=" Save "></apex:commandButton>
                <apex:commandButton action="{!cancel}" value=" Cancel "></apex:commandButton>
            </apex:pageBlockButtons>
       
       <apex:pageBlockSection id="sec01" title="Opportunity Details" columns="2">
           
           <apex:inputField label="Deal Size" value="{!opportunity.Amount}"/>                      
           <apex:inputField value="{!opportunity.owner.Name} "/>
           <apex:inputField value="{!opportunity.Name} "/>                      
           <apex:inputField value="{!opportunity.Account.Name} "/>
           <apex:inputField value="{!opportunity.StageName}"/>                      
           <apex:inputField value="{!opportunity.Probability}"/>
           <apex:inputField value="{!opportunity.ExpectedRevenue}"/>
           <apex:inputField value="{!opportunity.ForecastCategoryName}" style="width:130px"/>
           <apex:inputField value="{!opportunity.IsPrivate}"/>
           <apex:inputField value="{!opportunity.LeadSource}"/>
           <apex:inputField value="{!opportunity.NextStep}"/>
           <apex:inputField value="{!opportunity.Description}"/>
           
           <apex:inputField value="{!opportunity.type}" style="width:130px"/>
       </apex:pageblocksection>  
        
        
   </apex:pageBlock>
 </apex:form>

</apex:page>

 

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
vishal@forcevishal@force

Can you add <apex:pageMessages /> on your page, and rerender that on save button. It will help you catch any error/exception that system might be throwing.

All Answers

samreet_matharu@psl.co.insamreet_matharu@psl.co.in

You can use the extension and override the save functionality for the same and on save do not navigate to any other page.

Thanks,

vishal@forcevishal@force

Can you add <apex:pageMessages /> on your page, and rerender that on save button. It will help you catch any error/exception that system might be throwing.

This was selected as the best answer
metal-headmetal-head

Thanks for the responses.

 

I tried that, but in Professional Edition we can not write apex classes, so that rules out Extensions or Custom controllers, So I am wondering, can we successfully create a new record with the overriding visualforce page without  apex code?

 

I could override the page, it is coming just fine, but the problem starts when we hit "Save" ! ! ! it stays at the same page.

aballardaballard

As vishal@force suggests, you need to add an apex:pagemessages to your page to see any error messages.   Sounds like you probably have some required field in your object that has not been set and so prevents the save. 

 

You can certainly create objects without using any apex code.

metal-headmetal-head

Thanks,

 

We missed a required field.

 

        <apex:pageMessages />

 helped to identify that.

 

Thanks Gurus.