hiddenButtonValueBeforeDialog is undefined – SharePoint 2013 Error


Sathish Nadarajan
SharePoint MVP
Published On :   31 Mar 2016
Visit Count
Today :  2    Total :   3945
Plan, Migrate, Secure, Report
SharePoint & Office 365 Tool. Simple & Easy to Use. 15-Day Trial!

Sharegate: Kick-Ass Tool
Think Your SharePoint & Office 365 Are Secure ? Find Out Now!


We have been using the Modal Dialogs for a long time. But, for a new project, created a SitePage using designer and tried to use the ModalDialog using Javascript. I thought, it’s a straight forward as we have used the modal dialog for a long time.

 function OpenDocTopicPopup(bookcaseTopic) {
        
      var options = {
          url: '/pages/MyPage.aspx,
          title: ‘TEst’,
          allowMaximize: false,
          showClose: true,
          width: 1200,
          height: 500,
          dialogReturnValueCallback: Function.createDelegate(null, function (result, returnValue) {
              if (result == SP.UI.DialogResult.OK) {
                  OpenDocTopicPage(returnValue);
              }
          })
      };
      SP.UI.ModalDialog.showModalDialog(options);
  }
   
  function OpenDocTopicPage(returnValue) {
         
      window.location.href = window.location.href + "/" + returnValue;
  }
 

When I try to execute this, met with a strange exception like “hiddenButtonValueBeforeDialog is undefined” from the SP.UI.Dialog.JS file. After some googling, found the answer and thought of documenting in our forum as well.

Solution:

It’s a straight forward. Add the below Tag on your ASPX.

 <script type="text/javascript" src="/_layouts/15/ScriptResx.ashx?name=sp.res&culture=en-us"></script> 

Happy Coding,

Sathish Nadarajan.

SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Categories

Protect Your SharePoint