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
yogesh_sharmayogesh_sharma 

Pop Up Window

How to Open SubChild Window through Child Window when My Child Window is Open using Java Script?
I'm trying to open child window and then turough child window i m trying to open subchild window,but when i m open subchild window my child window get closed and subchild window open
PlZ Help??
Best Answer chosen by yogesh_sharma
Anurag JainAnurag Jain
Hi yogesh,

I checked you code  the mistake is in Child page,

You have taken same name for child and sub-child window that’s why it is opening in same window please change the name of sub-child window from “Popup” to “subchildPopup”(any any other you want) then it works fine… :)

Thanks
Anurag Jain

All Answers

Anurag JainAnurag Jain
Hi Yogesh,

you can open child from parent then sub child from child as well,

just call you new page from child page like this:-

Parent page:-
<apex:page>
<script>
function myFunction() {
    window.open("/apex/Child_Page","", "width=500, height=500");
    return false;
}
</script>
  <apex:form>
      <apex:commandButton value="page1" onclick="return myFunction();"/>
  </apex:form>
</apex:page>

Child_Page:-
<apex:page>
<script>
function myFunction() {
    window.open("/apex/Sub_Child_Page","", "width=500, height=500");
    return false;
}
</script>
  <apex:form>
      <apex:commandButton value="page2" onclick="return myFunction();"/>
  </apex:form>
</apex:page>

Thanks
Anurag Jain
yogesh_sharmayogesh_sharma
Thank You Anurag

I did the same but when my subchild window open then child window get closed.

I Want All three Window(Parent,child,subchild) in my browser.
Plz give me Solution.
yogesh_sharmayogesh_sharma
Parent Page::::

<apex:page controller="parentlookup" id="page_id">
	<script>
		function openLookupPopup(id) {
		   alert('**first page popup calling**');
			var url = "/apex/lookupdemo?idfield=" + id;
			window.open(
							url,
							'Popup',
							'height=500,width=900,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no');
			if (window.focus) {
				newWin.focus();
			}

			return false;
		}
	</script>
	<apex:form id="form">
<apex:pageBlock title="Lookup">
			<apex:pageBlockSection columns="2">
				<apex:outputLabel value="Account Name"/>
				<apex:outputPanel id="Parentkk">
					<apex:inputText value="{!AccountName}" id="targetId" />
					<img src="/s.gif"
						onclick="openLookupPopup('{!$Component.targetId}'); return false"
						class="lookupIcon" onmouseout="this.className='lookupIcon';"
						alt="Account Name Lookup (New Window)"
						onmouseover="this.className='lookupIconOn';" />
				</apex:outputPanel>
			</apex:pageBlockSection>
		</apex:pageBlock>
		</apex:form>
</apex:page>

Child page::::

<apex:page controller="parentlookup" id="thePage">
	
	<script language="JavaScript" type="text/javascript">
		function openLookupPopup(id) {
		alert('****second page popup calling***');
			var url = "/apex/LookupExample?idfield=" + id;
			 window.open(
							url,
							'Popup',
							'height=700,width=900,left=400,top=400,resizable=no,scrollbars=yes,toolbar=no,status=no');
						if (window.focus) {
							newWin.focus();
						}

			return false;
		}

		
	</script>

	<apex:form id="theForm">

		<apex:outputPanel id="hello">
		    <apex:outputLabel value="Account child"/>
			<apex:inputText value="{!AccountId}" id="targetId" />
			<img src="/s.gif"
				onclick="openLookupPopup('{!$Component.targetId}'); return true"
				class="lookupIcon" onmouseout="this.className='lookupIcon';"
				alt="Account Name Lookup (New Window)"
				onmouseover="this.className='lookupIconOn';" />
		</apex:outputPanel>
	</apex:form>
</apex:page>

Sub-Child Page::::

<apex:page controller="parentlookup" id="thePage">
	
	<apex:form id="theForm">
		<apex:outputLabel value="Name" />
		<apex:inputText value="{!pName}" id="abcd" />
		
	</apex:form>
</apex:page>
Plz have a look.
and suggest me.
Anurag JainAnurag Jain
Hi yogesh,

I checked you code  the mistake is in Child page,

You have taken same name for child and sub-child window that’s why it is opening in same window please change the name of sub-child window from “Popup” to “subchildPopup”(any any other you want) then it works fine… :)

Thanks
Anurag Jain
This was selected as the best answer
yogesh_sharmayogesh_sharma
Hi Anurag,

It works.
Thank you Very Much.