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
TLeahyTLeahy 

Visualforce Page - Command Button - Save reload current/parent window?

I created a visualforce page to add to one of my custom object layouts, so that basically I can have a group of fields display based on what is selected in a particular pick list. I added the command buttons 'Save' and 'Cancel' so that the choices can be saved once input. I have two minor issues; the more important one is that I want the page to refresh when save is clicked. Currently only the component area refreshes, not the entire page [it reloads a page within the page]. I want to make it so the parent page refreshes...or so that just the content area reloads and it doesn’t load the entire page inside a small box on the page.

 

Better yet, if I can have just the content area reload when a dropdown option is selected, rather than having to choose a dropdown option, save, then input fields, and save again. But, most pressing is having the parent page refresh rather than the component on save.

 

here is the code for what I added:

 

<apex:page standardController="Shipping__c" 
        tabStyle="Shipping__c">

<apex:form >
<apex:pageBlock title="Edit Matrix" id="EditMatrix" mode="edit">

    <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!save}"/>
        <apex:commandButton value="Cancel" action="{!cancel}"/>               
    </apex:pageBlockButtons>

    <apex:pageBlockSection >
    <apex:pageBlockTable id="matrix" value="{!Shipping__c}" var="Shipping__c" >

        <apex:column headerValue="display">
            <apex:actionRegion >        
            <apex:actionSupport event="onclick" reRender="matrix">
              <apex:inputField value="{!Shipping__c.test__c}"/>
            </apex:actionsupport>
            </apex:actionRegion>
        </apex:column>

        <apex:column headerValue="display matrix" rendered="{! IF(Shipping__c.test__c="one",TRUE,False)}">
            <apex:inputField value="{!Shipping__c.three__c}"/>
            <apex:inputField value="{!Shipping__c.two__c}"/>
        </apex:column>

        <apex:column headerValue="display matrix" rendered="{! IF(Shipping__c.test__c="two",TRUE,False)}">
            <apex:inputField value="{!Shipping__c.one__c}"/>
            <apex:inputField value="{!Shipping__c.four__c}"/>
        </apex:column>
  
    </apex:pageBlockTable>
    </apex:pageBlockSection>
    
</apex:pageBlock>
</apex:form>

</apex:page>

 

Any help would be much appreciated. Thanks!

Gunners_23Gunners_23

Did you try to rerender the section of the parent page when you call the Save method?

TLeahyTLeahy

How exactly do I do that? Tell it to re-render the page and not the section?