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
LithiumsLithiums 

JavaScript + vf Question

I was looking at this VF page which pops up a new vf page,Can someone tell me how it works.I understand the VF part but i have questions in javascript.

 

what is 'openPopup' and 'curPopupWindow' I dont see any functions in the code and they dont look like standard javascript functions. So how is the popup working.

 

 

<apex:page standardController="Task" >

<script type="text/javascript" src="/js/functions.js"></script>

<script type="text/javascript">
var Author = { Attach : { Window : null, At : null}}

Author.Attach.At = function(event) {
      try {
        
        openPopup('{!URLFOR($Page.TestPage)}?pid={‘0000000000’}', 'doc', 480, 540,
            'width=480,height=540,scrollbars=yes,toolbar=no,status=no,directories=no,menubar=no,resizable=1', true);
        Author.Attach.Window = curPopupWindow;      
        
      } catch(e) { }
    }
</script>


<apex:form forceSSL="true" id="theForm">

    <apex:pageBlock mode="edit">
       <apex:pageBlockButtons id="pb_Buttons">
        <input type="button" value="Attach File" title="Attach File (New Window)" class="btn" onclick="Author.Attach.At(event)" />
              </apex:pageBlockButtons>
      </apex:pageBlock>
      </apex:form>
</apex:page>

 

 

Best Answer chosen by Admin (Salesforce Developers) 
aballardaballard

You should not use undocumented salesforce javascript functions that you happen to find by inspecting the page source. They are likely to change without notice at any time.

All Answers

_Prasu__Prasu_

Those methods should be in the "/js/functions.js" file.

LithiumsLithiums

I was not able to find the file in static resources or anywhere else,

 

so I removed the refereence to ""/js/functions.js" file" and the popup still works

aballardaballard

You should not use undocumented salesforce javascript functions that you happen to find by inspecting the page source. They are likely to change without notice at any time.

This was selected as the best answer
LithiumsLithiums

I found this code somewhere and was wondering where the function was, now this answeres my question. So this is from the source page.