You need to sign in to do that
Don't have an account?
RDeepa
How to pass the value from popup window (Child window) to the main VF page (parent window)?
Hi,
I have a requirement to develop a lookup search in Visualforce. I am able to show the list of of records in a popup window when the user clicks on a magnifying glass. I am not able to pass the selected value from the popup window to the main VF page (Parent window).
Can anyone please suggest me on this?
Thanks,
Deepa
You have to use Modal Windows to hold the context between the two windows.
Please refer below-
Modal Windows
Cool_D
Thanks a lot for your suggestion.
I am not able to get the exact picture of the suggested solution. I wanted to implement the lookup search for the standard Activities Related To field. This is a combination of picklist and lookup fields.
The way which I tried is, I had a picklist, a text field and a commandLink for the Loopup image. For onclick i gave the lookup VF page url and i passed the selected value from the picklist. As I said, I am not able to pass the selected value from the child window to the parent. How can i use Modal Windows for this case? Can you provide me any sample code if u have any?
Thanks,
Deepa
Hi Deepa,
The point to note over here is that you cannot use a seperate VF page as a pop up in such a case when you want to pass some value from the child window to parent window. Reason being that the conetxt will be reset!
What you have to do is that keep the pop-up window hidden on the same VF page using a DIV tag or an outputPanel and then render it using JavaScript positioning it on the top of your parent window. You can use 3rd party JS libraries to achieve this and YUI is one of them as i posted the link above.
In this way, you will be working within the same context and can easily pass values between the pop-up and the main page!
Hope this helps!!
Cool_D
Hi,
Is there any javascript function available to pass the value from child window to the parent window? So that, I can prepopulate the value on the page with the component ID.
Regards,
Deepa
Well ... that is exactly why i gave you the link ;)
3rd party JS is nothing but a JS function which will help you position the pop-up on top of the page! Within that pop-up, you can call an action method which will update the field in the backend and then all you need to do is to reRender that particular section on the page so that it shows the updated value from the getter!!
Cool_D
Hi Deepa,
I am also facing the same problem.I am implementing the concept of lookups as in salesforce using visulaforce with apex.
i am unable to pass the value from child window to parent window.If u found the solution plz send me the code.
Thanks in advance,
manu..
Below works for me:
Parent Page
Child Page
Try the below code
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com