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
Laytro80Laytro80 

Simple error

I am sure this is a simple error,  code snippet below.

 

When I hit save the url of the apex page stays within the browser address bar.

 

Just can't see what I am doing wrong.

 

 

   public PageReference save() {
        insert slots;
        PageReference home = new PageReference('/a00/o');
        home.setRedirect(true);
        return home;
    }

 

 

kiranmutturukiranmutturu

nohting wrong its working fine for me....

 

 

 

 

Regards,

 

Kiran

goabhigogoabhigo

Can you post the VF page code?

Laytro80Laytro80

Still have the same error, code below for the VF page and controller.

 

 

<apex:page Controller="TimeEntry" tabStyle="Time_Slot__c">
    <apex:sectionHeader title="Multi Add"/>
        <apex:form >
    <apex:pageBlock title="Time Slot Quick Entry">
            <p>Fill in the rows below, when you choose a record type please ensure you select the corresponding type.</p>
            <p>&nbsp;</p>
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}" rerender="error" />
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!slots}" var="t" id="table" columnsWidth="50px, 50px, 50px, 100px, 100px, 50px, 300px">
                <apex:column headerValue="Record Type">
                    <apex:inputField value="{!t.recordtypeid}" required="true"/>
                </apex:column>
                <apex:column headerValue="Date">
                    <apex:inputField value="{!t.Date__c}" required="true"/>
                </apex:column>                  
                <apex:column headerValue="Type">
                    <apex:inputField value="{!t.Type__c}" required="true"/>
                </apex:column>
                <apex:column headerValue="Project">
                    <apex:inputField value="{!t.Project__c}"/>
                </apex:column> 
                <apex:column headerValue="Opportunity">
                    <apex:inputField value="{!t.Opportunity__c}"/>
                </apex:column>                                
                <apex:column headerValue="Time Spent">
                    <apex:inputField value="{!t.Time_Spent__c}" required="true"/>
                </apex:column>
                <apex:column headerValue="Description">
                    <apex:inputField value="{!t.Description__c}" rendered="true"/>
                </apex:column>   
            </apex:pageBlockTable>
    <apex:pageblockButtons location="bottom">
        <div style="text-align:right;margin-right:30px;font-weight:bold;">
            <apex:commandLink value="Add Row" action="{!addRow}" rerender="table,error" immediate="true" />
&nbsp;|&nbsp;&nbsp;
            <apex:commandLink value="Remove Row" action="{!removeRow}" rerender="table,error" immediate="true" />                
        </div>
    </apex:pageblockButtons>  
    </apex:pageBlock>
    </apex:form>
</apex:page>

 

 

 

public class TimeEntry {

    public List<Time_Slot__c> slots {get; set;}
    
    public TimeEntry(){        
        slots = new List<Time_Slot__c>();
        slots.add(new Time_Slot__c());
    }

    public void addrow() {
        slots.add(new Time_Slot__c());
    }
           
    public void removerow(){
        Integer i = slots.size();
        slots.remove(i-1);
    }
           
    public PageReference save() {
        insert slots;
        PageReference home = new PageReference('/a00/o');
        home.setRedirect(true);
        return home;
    }
}

 

 

 

goabhigogoabhigo

Have you overridden the Tab link to your VF page? [ Setup-Create-Objects-Your Object-Standard Buttons and Links-Tab]

Laytro80Laytro80

No I use a custom link from the home page to go to the VF Page.

 

I have just added a new tab using the VF with the same problem.

goabhigogoabhigo

What is been selected in Setup-Create-Objects-Your Object-Standard Buttons and Links ?? Is the overridden column is checked?

Laytro80Laytro80

Hi,

 

No the standard button and links table does not have any overidden ticks.

 

I want to keep the standard views in place.

 

The VF page is another type of non standard data entry.

 

Thanks