• Alex Skempris9
  • NEWBIE
  • 0 Points
  • Member since 2016

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

I've built a VF page along with a controller extension. This page is a long questionnaire that spans over four to five pages/screens that the users have to scroll through but once they hit the save button they get redirected back to the top of the page. I want the page to automatically scroll back to the place they were working at, much like a standard Salesforce record page does after refreshing. 

Here's a snippet of my VF page and save methods:

VF PAGE: 

<apex:pageBlock title="Properties" tabstyle="Mortgages__c">
           <apex:outputlabel style="color:red;font-style:italic;font-size:16px;white-space:pre;" value="Thank you for your responses so far, I’d now like to ask you some questions regarding your current address and your housing arrangements…."/>
           
           <apex:commandButton action="{!newProperty}" value="New Property" rendered="{!NOT(ISBLANK(Account.id))}"/>
           <apex:outputPanel id="propertyList"> 
                <apex:repeat value="{!Properties}" var="prop" >
                    <apex:pageBlockSection title="Property {!prop.name}"  columns="1" collapsible="true">
                     <apex:pageBlockSectionItem >
                              <apex:pageBlockSection columns="2">
                                <apex:outputField value="{!prop.Client__c}"/>
                                <apex:inputField value="{!prop.Joint_Client__c}"/>
                                <apex:inputField value="{!prop.Street__c}"/>
                                <apex:inputField value="{!prop.Town__c}"/>
                                <apex:inputField value="{!prop.Postcode__c}"/>
                                <apex:outputlabel style="color:Blue;font-style:italic;font-size:14px;" value="**Essential**"/>
                                <apex:inputField value="{!prop.Date_Acquired__c}" label="When did you purchase the property?"/>
                                <apex:inputField value="{!prop.Year_of_Build__c}" label="In what year was the property built?"/>
                              </apex:pageBlockSection>
                           </apex:pageBlockSectionItem>
                            <apex:commandButton value="Delete Property" action="{!deleteProperty}" rerender="propertyList">
                               <apex:param name="propertyIdent" value="{!prop.id}" assignTo="{!chosenpropertyId}"/>
                            </apex:commandButton>
                        </apex:pageBlockSection>
                </apex:repeat>
            </apex:outputPanel>
            </apex:pageBlock>

APEX CLASS:
public PageReference save()
    {
     Boolean result=true;
     PageReference pr=Page.myVFpage;
     if (null!=getAccount().id)
     {
      result=updateProperties();

     }
     else
     {
      pr.setRedirect(true);
     }
      
     if (result)
     {
        // call standard controller save, but don't capture the return value which will redirect to view page
        std.save();
           ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Changes saved'));
     }
        pr.getParameters().put('id', getAccount().id);
      
     return pr;
    }
hi, 
I'm working on the below link trailhead. 
https://trailhead.salesforce.com/modules/lex_dev_lc_vf_concepts/units/lex_dev_lc_vf_concepts_basics

I'm not able to understand what's needs to be done on the step 2. 

1.Create a new Lightning component named myEverythingComponent
2. Add this static text to the component: I'll have one with everything
3. Add each resource type to the component, by clicking Create for each resource type: Controller, Helper, Style, Documentation, Renderer, Design, SVG

can someone please assist me on this? 
Hello

I've built a VF page along with a controller extension. This page is a long questionnaire that spans over four to five pages/screens that the users have to scroll through but once they hit the save button they get redirected back to the top of the page. I want the page to automatically scroll back to the place they were working at, much like a standard Salesforce record page does after refreshing. 

Here's a snippet of my VF page and save methods:

VF PAGE: 

<apex:pageBlock title="Properties" tabstyle="Mortgages__c">
           <apex:outputlabel style="color:red;font-style:italic;font-size:16px;white-space:pre;" value="Thank you for your responses so far, I’d now like to ask you some questions regarding your current address and your housing arrangements…."/>
           
           <apex:commandButton action="{!newProperty}" value="New Property" rendered="{!NOT(ISBLANK(Account.id))}"/>
           <apex:outputPanel id="propertyList"> 
                <apex:repeat value="{!Properties}" var="prop" >
                    <apex:pageBlockSection title="Property {!prop.name}"  columns="1" collapsible="true">
                     <apex:pageBlockSectionItem >
                              <apex:pageBlockSection columns="2">
                                <apex:outputField value="{!prop.Client__c}"/>
                                <apex:inputField value="{!prop.Joint_Client__c}"/>
                                <apex:inputField value="{!prop.Street__c}"/>
                                <apex:inputField value="{!prop.Town__c}"/>
                                <apex:inputField value="{!prop.Postcode__c}"/>
                                <apex:outputlabel style="color:Blue;font-style:italic;font-size:14px;" value="**Essential**"/>
                                <apex:inputField value="{!prop.Date_Acquired__c}" label="When did you purchase the property?"/>
                                <apex:inputField value="{!prop.Year_of_Build__c}" label="In what year was the property built?"/>
                              </apex:pageBlockSection>
                           </apex:pageBlockSectionItem>
                            <apex:commandButton value="Delete Property" action="{!deleteProperty}" rerender="propertyList">
                               <apex:param name="propertyIdent" value="{!prop.id}" assignTo="{!chosenpropertyId}"/>
                            </apex:commandButton>
                        </apex:pageBlockSection>
                </apex:repeat>
            </apex:outputPanel>
            </apex:pageBlock>

APEX CLASS:
public PageReference save()
    {
     Boolean result=true;
     PageReference pr=Page.myVFpage;
     if (null!=getAccount().id)
     {
      result=updateProperties();

     }
     else
     {
      pr.setRedirect(true);
     }
      
     if (result)
     {
        // call standard controller save, but don't capture the return value which will redirect to view page
        std.save();
           ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Changes saved'));
     }
        pr.getParameters().put('id', getAccount().id);
      
     return pr;
    }
I'm using a visual force page with an extended controller. When I click on the 'Save Only' button the page reloads to the top. How can I keep the focus on the field that a user was on prior to saving ? I am using the save action on the standard controller, not the extended controller. 
 
<apex:page id="page" standardController="Comm_Auto_Audit_Sample_Policy__c"  extensions="AuditCommAutoPolicySampleController"  > 
.....
<apex:commandButton styleClass="myClass" value="Save Only" action="{!Save}"/> 
<apex:commandButton styleClass="myClass" value="Save and Return to Template" action="{!saveAndReturn}"/>

 

Hi!  

 

When actionSupport component rerender other visualforce components, scrollbar page is reset to top but I would  like to keep position of page.  Any solution?

 

Thanks in advance.