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
Roger WickiRoger Wicki 

Rerender Visualforce component & reload parent window on close

Dear Community

I try to implement some fancy stuff for my form but I ssem to oversee something. The first and kind of important part is to rerender a component on the form after certain checkbox is checked.
It should represent the functionality that for one of the choices, we need more input.
Part of my page:
<apex:pageBlockSection collapsible="false" title="3. How is marketing budget used?" id="thirdQuestion">
	<apex:outputPanel id="thirdQuestionOne">
		<apex:selectCheckboxes value="{!selectedBudget}" layout="pageDirection">
			<apex:selectOptions value="{!budget}"/>
			<apex:actionsupport event="onclick" action="{!CheckRendered}" rerender="thirdQuestionTwo" status="status"/>
		</apex:selectCheckboxes>
	</apex:outputPanel><br/>
	<apex:actionStatus id="status" startText="Please wait..." stopText=""/>
	<apex:outputPanel id="thirdQuestionTwo" rendered="{!isSubSelectRendered}">
		<apex:selectCheckboxes value="{!selectedPlatforms}" layout="pageDirection">
			<apex:selectOptions value="{!platforms}"/>
		</apex:selectCheckboxes>
	</apex:outputPanel>
</apex:pageBlockSection>
Important code pieces of my controller:
// Data Variables
public list<String> selectedBudget {get; set;}

// Control Variables
public Boolean isSubSelectRendered {get; set;}

public CancellationReportController()
{
	isSubSelectRendered = false;
	selectedBudget = new list<String>();
}

public list<SelectOption> getBudget()
{
	list<SelectOption> options = new list<SelectOption>();
	options.add(new SelectOption('PRINT','Print'));
	options.add(new SelectOption('FAIR','Fairs'));
	options.add(new SelectOption('ONLINE_SHOP','Investment in own online shop'));
	options.add(new SelectOption('WEBSITE','Investment in own website'));
	options.add(new SelectOption('NOTHING','No activities planned'));
	options.add(new SelectOption('OTHER_PRESENCE','Presence on other platforms (please specify)'));
	return options;
}

public void checkRendered()
{
	if ( new set<String>(selectedBudget).contains('OTHER_PRESENCE') )
	{
		isSubSelectRendered = true;
	}
}
When i simply render the second output panel neglecting the controller boolean value, I see that panel on the page and can use it, so it is set up correctly. What I do not know is where I have to put the action support tag or how I can make it do more than simply displaying the status and actually rerender the second output panel.


The second issue: Reloading the parent window on form close/submit.
I have a save button, which calls the save function in the controller and then closes the form window on completed calculations.
<apex:pageBlockButtons>
	<apex:commandButton action="{!save}" value="Save" id="SaveButton" oncomplete="window.top.close();"/>
</apex:pageBlockButtons>
The form was initially called by a salesforce Formula field using the HYPERLINK() function as below:
HYPERLINK('/apex/CancellationReport?accId=' + Account.Id + '&oppId=' + Id, 'Fill out the Form', '_blank]')

Can anybody tell me how I can achieve the form to reload my initial Salesforce page? The link to open the form can not be a button on the layout; it should be right next to a field.
User-added image

Many thanks ahead ;)
Roger
Roger WickiRoger Wicki
Oh and the form window should not replace the salesforce page, so '_blank' as the hyperlink's target should not be changed to '_self'. Changing it to '_parent' did not help as well...