SP2013 SharePoint-hosted app Modal Dialog Error: Cannot read 'hiddenButtonValueBeforeDialog' -


i'm trying prove concept of displaying modal dialog in sharepoint-hosted app page. believe i've included required js libraries , give more enough time load libraries before execute function. error receive is:

cannot read property 'hiddenbuttonvaluebeforedialog' of undefined

i believe have libraries need::

<script type="text/javascript" src="/_layouts/15/init.js"></script> <script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script> <script type="text/javascript" src="/_layouts/15/sp.js"></script> <script type="text/javascript" src="/_layouts/15/sp.userprofiles.js"></script> <script type="text/javascript" src="/_layouts/15/sp.core.js"></script> <script type="text/javascript" src="/_layouts/15/sp.ui.dialog.js"></script> 

javascript:

function showdialog() {  var optdict = {     width: 800,     height: 500,     url: 'http://www.google.com',     title: "upload file" };  try {     sp.ui.modaldialog.showmodaldialog(optdict); } catch (err) {     alert(err.message); }      return false; } 

the error cannot read property 'hiddenbuttonvaluebeforedialog' of undefined occurs since sp.ui.dialog.js globalized javascript library , required resource file sp.res.resx has not been loaded on client side (sp.res.hiddenbuttonvaluebeforedialog generated file).

solution

  1. scriptresx http handler used load content of resource files on client side, following line has added:

    <script type="text/javascript" src="/_layouts/15/scriptresx.ashx?name=sp.res&culture=en-us"></script> 
  2. in addition, since there dependency sp.ui.uiutility namespace in sp.ui.dialog.js library, sp.init.js javascript library has referenced:

    <script type="text/javascript" src="/_layouts/15/sp.init.js"></script> 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -