1

Resolved

Media Library Picker Field : Selected media not saved

description

In latest version, add a Media Library Picker Field to a content (ex : add Image to Blog Post).

When you edit a content and select a media, the onClosed function has an error and doesn't set the associated media id.
In Modules\Orchard.MediaLibrary\Views\EditorTemplates\Fields MediaLibraryPicker.Edit.cshtml, line 118 :
 var template = @(fieldIdForIds)_Template
  .replace(/\{contentItemId\}/g, selectedData[i].id)
Only one media is selected but it iterates 2 two times and the second times, selectedData[i].id is undefined so it raises a javascript error and the refreshIds method is not called.

If you add this kind of code, it works :
if (selectedData[i] == null)
    break;
but we should find why the selectedData is incorrect.

comments

sebastienros wrote Mar 29 at 5:58 PM

Fixed in changeset 873f9fea5a7d7a9c505188d278ea15458be40994

sebastienros wrote Mar 29 at 5:58 PM

Fixed in changeset 5171e9089f232f2894e22972d3eb0c12605fd468

sebastienros wrote Mar 29 at 6:10 PM

I have hot patched the release because of this issue.