Hi
I should returned in a property on that object. I don't remember exaclty, but I would try returnValue.href. If that doesn't work I would add a breakpoint in FireBug and inspect the returnValue object more closely.
Regards
Per Gunsarfs
EPiServer Development Team
Hello Jonas,
Were you able to find a solution to the problem. Iam facing similar issues now. Since while trying to get the image url it returns an object, not sure why that is ??
Regards
MJ
Hi,
I just had the exact same problem and used the developer tool in IE to find out what was going on.
Instead of this code:
function OnFileDialogClosed(returnValue, callbackArguments) {
if (returnValue != undefined && returnValue != 0) {
var myCtrl = document.getElementById(callbackArguments.myControlId);
myCtrl.value = returnValue
}
}
I hade to use this to get hold of the value I wanted:
function OnFileDialogClosed(returnValue, callbackArguments) {
if (returnValue != undefined && returnValue != 0) {
var myCtrl = document.getElementById(callbackArguments.myControlId);
myCtrl.value = returnValue.items[0].path
}
}
Don't really know the reason behind this though...
I should also add that this occurred after I upgraded a site from CMS5 R2 SP2 to CMS 6 R2.
Regards
Nicklas
In our custom property we use the FileManagerBrowser.aspx in a dialog to retreive the path to the selected image.
Here is the code:
function OpenFileDialogLink(url, pageId, parentPageId, folderId, selectedfile, tbClientID) { url += '?id=' + pageId + '&parent=' + parentPageId + '&folderid=' + folderId; url += '&browserselectionmode=image&selectedfile=' + selectedfile; var linkAttributes = new Object(); var dialogArguments = linkAttributes; var features = { width: 600 }; var callbackArguments = new Object(); callbackArguments.myControlId = tbClientID; /* opens the filemanagerbrowser dialog */ EPi.CreateDialog(url, OnDialogClosed, callbackArguments, dialogArguments, features); return false;}
function OnDialogClosed(returnValue, callbackArguments) { if (returnValue != undefined && returnValue != 0) {
var myCtrl = document.getElementById(callbackArguments.myControlId); myCtrl.value = returnValue; SetPreviewImage(callbackArguments.myControlId); }}
Calling it with the following code:
btFile.OnClientClick = string.Format("return OpenFileDialogLink('{0}', '{1}', '{2}', '{3}', '{4}', '{5}')",
EPiServer.UriSupport.ResolveUrlFromUIBySettings("edit/FileManagerBrowser.aspx"),
CurrentPage.PageLink, CurrentPage.ParentLink, pageDirName,
System.Web.HttpUtility.UrlEncode(tbFile.Text), tbFile.ClientID);
The problem is that the returnValue parameter is not the selected file's path but instead [object Object]. We are using EPiServer CMS 6. Any help would be very appreciated!