When i click on the image it's show javascript alert in alert i got the id and open popup which is fine but after that when i call apex controller method using actionfunction i got string value null in debug log and no value shown on my popup.

 public class DataFromJsController{
   public String embstr{get;set;}
   public DataFromJsController(){


  public void embFile(){


<apex:page controller="DataFromJsController">
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">  

    <apex:stylesheet value="{!URLFOR($Resource.SLDS0}" />

        function embded(recordId){

       function hidePopUp(){
       <apex:form id="frm">
         <div class="slds">
       <apex:actionFunction name="embFile" action="{!embFile}">
           <apex:param assignTo="{!embstr}" name="prm" value=""/>

        <apex:repeat value="{!NameMapForAcc}" var="r">

         <apex:commandLink onClick="embded('{!r}'); return false;">
             <apex:image value="{!$Resource.eLogo}" width="20" height="3"/> 

  <div class="popupEmb" style="display:none">
           <div class="slds-modal slds-fade-in-open" aria-hidden="false" role="dialog">
                 <div class="slds-modal__container">
                    <div class="slds-modal__header">
                     <h2 class="slds-text-heading--medium">Embed item</h2>
             <div class="slds-modal__content slds-p-around--medium" style="position:relative;">
                  <div class="slds-modal__content slds-p-around--medium">
                  <apex:outputPanel layout="block" id="newModelContentemb" style="overflow:auto;height:30vh">

                     <fieldset class="slds-form--compound">
                          <legend class="slds-form-element__label"></legend>
                          <div class="form-element__group">
                            <div class="slds-form-element__row">
                              <div class="slds-form-element slds-size--1-of-2">
                                  <label class="slds-form-element__label">Embed Item</label>
                                     <input type="Text" styleClass="slds-input" style="margin: 0px; width: 549px; height: 32px;"  value="Only the owner and explicitly shared collaborators have access" disabled="true"/>

                                       Paste HTML to embed in website:<br/>
                                        <Textarea readonly="true" cols="75" rows="5" id="textareaEmb" styleClass="slds-box"  style="margin: 0px; width: 550px; height: 70px;">
&lt;iframe src="https://drive.google.com/file/d/"+{!embstr}+"/preview""  
 width="640" height="480"&gt; &lt;/iframe&gt;   {!embstr}

                <div class="slds-modal__footer">
                  <button class="slds-button slds-button--neutral slds-button--brand"  onclick="hidePopUp(); return false;">Ok</button>

            <div class="slds-backdrop slds-backdrop--open"></div>



2 Answers 2


I think, you are missing rerender attribute for actionFunction and because of this, value is not getting passed.

<apex:actionFunction name="embFile" action="{!embFile}" rerender="frm">
    <apex:param assignTo="{!embstr}" name="prm" value=""/>

In actionfunction's param, if you do not populate the "rerender" attribute, the value is not passed back correctly to the controller:

<apex:actionFunction name="embFile" action="{!embFile}" reRender="myPage">
           <apex:param assignTo="{!embstr}" value=""/>

Source: https://success.salesforce.com/ideaView?id=08730000000YcV8AAK

In similar way, if you can just use name attribute and do not pass assignTo:

<apex:actionFunction name="embFile" action="{!embFile}" reRender="myPage">
           <apex:param name="prm" value=""/>

 In apex controller

String prm = apexpages.currentpage().getparameters().get('prm');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.