Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am trying to open the "OOB" AssetPortalBrowser.aspx from a page within a SharePoint native modal popup.

My aim is to get the selected filename back to the script. So far I was able to open the popup with the AssetPortalBrowser.aspx, but I don't know how to "close" the popup while clicking the built-in "OK" button on the AssetPortalBrowser.aspx.

When I click OK the AssetPortalBrowser.aspx page within the modal popup does not completely close. Instead the popup changes to a box with the following text:

"Please wait while your changes are processed."

and a title

"Processing...".

More specifically, I don't know where to write the code to close the form and return to the "dialogReturnValueCallback" function (just like it happens when the "Cancel" button gets clicked").

Please find below my code:

function InitiateAssetPickerPopUp(){

var context = new SP.ClientContext.get_current();
this.Web = context.get_web();
context.load(this.Web);
context.executeQueryAsync(Function.createDelegate(this, this.onSuccess),
    Function.createDelegate(this, this.onFail));
}

function onSuccess(sender, args){

var options = {
            title: 'My Dialog',
            width: 500,
            height:600,
            showClose: false,
            url: _spPageContextInfo.siteServerRelativeUrl+'/_layouts/AssetPortalBrowser.aspx?&AssetUrl='+_spPageContextInfo.siteServerRelativeUrl+'&RootFolder='+_spPageContextInfo.siteServerRelativeUrl+'&MDWeb='+this.Web.get_id()+'&AssetType=Link',
            dialogReturnValueCallback:function(dialogResult) 
            { 
              alert(dialogResult);
            }
  };  
  SP.UI.ModalDialog.showModalDialog(options);  
}

function onFail(sender, args) {
alert('Failed:' + args.get_message());
}
share|improve this question
add comment

1 Answer 1

That action will need to be adjusted on asset portal browser page itself. The OK button commits differently than the cancel button does. What I would do personally is set up a JScript function on load in that page to look for a URL param. If that param equals..let's say 1 ... Look for the OK button on that page and change the on click function to the same as the cancel..if this applies... That way you are not changing the ootb functionality of the page. And still get the result you want. So your callback listener will see the dialogue result instead of an incomplete process

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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