hiddenButtonValueBeforeDialog is undefined – SharePoint 2013 Error

Sathish Nadarajan
 
Solution Architect
March 31, 2016
 
Rate this article
 
Views
7684

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.

Category : JavaScript, SharePoint

Author Info

Sathish Nadarajan
 
Solution Architect
 
Rate this article
 
Sathish is a Microsoft MVP for SharePoint (Office Servers and Services) having 15+ years of experience in Microsoft Technologies. He holds a Masters Degree in Computer Aided Design and Business ...read more
 

Leave a comment