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
rupesh ranjanrupesh ranjan 

Not getting any Value in CK editor on Parent Page . Value is coming through action button of child page How to reRender the Parent page

Not getting any Value in CK editor on Parent Page . Value is coming through action button of child page
How to reRender the Parent page
//////////////////////Parent Page////////////////////////////////
<apex:page StandardController="Contact"  extensions="AccountSelectClassController" > 
<script>
var newWin=null;
        function check(){
            var url='/apex/selectvideo2';
            newWin=window.open(url, 'Popup','height=500,width=700,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no');
        }

        function closePopup(){
            if (null!=newWin){
                newWin.close();
             
            }  
        }
</script> 
<apex:form id="frmId">
<apex:outputLabel value="Choose Video "/>
<apex:outputLink onClick="check();return false;"> <br/>
Click here to choose session </apex:outputLink>
<br/><br/>
<apex:outputLabel value="Body" for="Body"/>:<br/>
<apex:inputtextarea value="{!body}" id="body" styleClass="ckeditor" richtext="false" style="width: 500px; height: 150px;">
</apex:inputtextarea>
<br/><br/><br/>        
<apex:includescript value="{!URLFOR($Resource.CkEditor,'ckeditor/ckeditor.js')}" />
</apex:pageblock>
</apex:form>
</apex:page>
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ child Pop up page////////////////////////////////
<apex:commandButton value="Done" onclick="CloseWindow(); return false;" action="{!callapi2}" />
</apex:pageBlock>
<script>
        function CloseWindow(){
            var winMain=window.opener;
            if (null==winMain){
                winMain=window.parent.opener;
            }
            winMain.closePopup()   
        }
</script>    
</apex:form>

/////////////////////////Controller\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

public void callapi2(){
 //body = '';
 String  SessionId = '';
 for( consolewrap cwt : selectedWrapperList){
 if(cwt.selected){
  if(SessionId == ''){
   SessionId += cwt.sid;
  }else{
   SessionId += ','+ cwt.sid;
  }
  }
   } 
 
      List<video> ConsoleWrapperList1 = new List<video>();
        HttpRequest req = new HttpRequest(); 
        HttpResponse res = new HttpResponse();
        Http http = new Http(); 
        req.setEndpoint('http://webapi.demomail.net/test/SendVideoBody.js?id='+SessionId); 
        req.setMethod('GET');
        res = http.send(req);
        if(res.getstatusCode() == 200 && res.getbody() != null){ 
            String replaceIllegal= res.getbody().replaceAll('\n','').replaceAll('\r','').replace('','');
            ConsoleWrapperList1=(List<video>)System.JSON.deserialize(replaceIllegal,List<video>.class);
            
            body = ConsoleWrapperList1.get(0).bodyT;
            System.debug('***********: '+ body );
        }
  
 }
thatheraherethatherahere
Hi Rupesh,

In you code you are not passing any value from Child window to Parent Window. 

change you child window code to:
<apex:commandButton value="Done" action="{!callapi2}" reRender="scriptPanel" oncomplete="CloseWindow();"/>
</apex:pageBlock>

<apex:outputPanel id="scriptPanel">
	<script>
		var parentInput = "{!body}";
        function CloseWindow(){
            var winMain=window.opener;
            if (null==winMain){
                winMain=window.parent.opener;
            }
            winMain.closePopup( parentInput ); // This will pass body value to parent window.
        }
	</script>    
</apex:outputPanel>
</apex:form>
and change code on you parent window as:
function closePopup( val ){
    if (null!=newWin){
        newWin.close();
    }
    
    document.getElementById("[Put ID of you apex:inputtextarea]").value=val;  
}


- thatherahere


 
rupesh ranjanrupesh ranjan
document.getElementById("[Put ID of you apex:inputtextarea]").value=val;  (didn't under stand)
thatheraherethatherahere
Run your Parent page, do a right click on your text area, select Inspect Element from menu items. In Inspect element you will see your text area with Id something similiar to "j_id0:frmId:body" copy this ID value and paste it into :
 
document.getElementById("PASTE ID HERE").value=val;

Save your VF page and run it again.

- thatherahere
rupesh ranjanrupesh ranjan
value are showing in parent window but not in ck editor other textbox
rupesh ranjanrupesh ranjan
@thatherahere's : will you pls share your email id?