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
LearnSFDCLearnSFDC 

I-frame-how to pass values to the apex page which I am using as a source in iframe

I am new to salesforce.My requirement is to show values from an external application in salesforce for which i need to pass some input parameters from salesforce.I am using a i-frame in a VF page and using another VF page as the source for the i-frame as i need to do encoding and validation in the child page.My main page is as below

<apex:page standardController="Case"> <apex:iframe id="xyz" src="/apex/ChildPage"></apex:iframe> </apex:page>

How do i get all the values of the Case object from this page to the ChildPage or can i refer to the parent page from the child page.Any pointers is highly appreacitated

Best Answer chosen by Admin (Salesforce Developers) 
LearnSFDCLearnSFDC

Thanks Imran.I should have realized that eventually it is same as an url.

 

To other beignners who might face the issue pass the param as a querystring as stated above and in the child page you need to use the below piece of code

var caseId= '{!$CurrentPage.parameters.CaseId}';

 

It will not fetch value from your request parameter.

All Answers

Imran MohammedImran Mohammed

You can either use Query String parameters.

For ex: <apex:iframe id="xyz" src="/apex/ChildPage?par1=val1;&par2..........."></apex:iframe>

 

Or you can either pass the Case Id to the child page as Query String parameter and in the child page Apex code you can get the Case Id and then further query the Case object based on the CaseId.

ex: <apex:iframe id="xyz" src="/apex/ChildPage?CaseId={!Case.id}"></apex:iframe>

 

Make the changes accordingly to the code.

Hope this helps.

LearnSFDCLearnSFDC

Thanks Imran.I should have realized that eventually it is same as an url.

 

To other beignners who might face the issue pass the param as a querystring as stated above and in the child page you need to use the below piece of code

var caseId= '{!$CurrentPage.parameters.CaseId}';

 

It will not fetch value from your request parameter.

This was selected as the best answer
Imran MohammedImran Mohammed

I will suggest you paste that particular piece of code how you did it for both the pages.

 

Pradeep_NavatarPradeep_Navatar

You can build validation on parent page for a child page by using javascript and ensure that you are using correct javascript methods. For a child page validation like window.parent.parent.document.getElementById('id of any component').value = '';

 

Hope this helps.

Imran MohammedImran Mohammed

Hi Pradeep,

 

I did not get your point.

Can you be little bit clearer?