Download & Extend

Submit button does not work in Media Browser when selecting media

Project:Media
Version:7.x-1.3
Component:WYSIWYG integration
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I added a file field to a content type. When using the Media Browser to add media - "Select Media" and the "My files" tab - the submit button doesn't do anything.

I did a fresh install and the problem did not occur. I then enabled the same modules as the site I was having problems with and the problem showed up. So I disabled modules one at a time and found disabling the core "Contextual Links" module fixes the problem.

I'm currently using Drupal 7.16 and the latest 7.x-2.x-dev releases of media and file_entity dated Oct 30, 2012. I've had this problem for quite some time and know the problem exists in earlier releases but I don't know when it started.

The problem occurs with Firefox, Chrome and IE.

Comments

#1

Any error in the javascript console when you click the button?

#2

I don't get anything when I press Submit from both the Firebug console and the Firefox Javascript console (Ctrl Shift K).

I'm thinking the error is the Contextual links module in combination with another module. I'm going to re-enable Contextual Links and try disabling all other possible modules and see if I can identify a second module.

#3

I've made some progress.

First, the Submit button always works if I don't select media, I get the message "You have not submitted anything".

If I am using the default Media Browser, and I disable either the DHTML or the Contextual Links module, the Submit button works ok.

If I clone the Media Browser View and have two media browser views or if I disable the default Media Browser and just have my cloned Media Browser, then the Submit button does not work. I've tried disabling every module possible and the submit button still does not work.

So I tried editing the default Media Browser View. I deleted the Filename Filter, still ok. I added a entity reference relationship to a content type, still ok. Then I created a filter using the title from that relationship - the submit button quit working. So I reverted the View and did exactly the same thing, added a filter to the entity reference -- Now the submit button works ok.

Anyone have ideas on what I can pursue? I have xdebug working and can step through the code but would like an idea where to look.

#4

which theme you use? i am trying with seven right now and chrome and cant trigger this. if you use a non-standard theme, can you check with seven?

#5

I started with AT Responsive Corolla, then tried Bartik, and Garland. They all had the problem.

#6

I spent the last 3 hours trying different combinations of modules. I found two more modules that are affecting the Submit button in the Media Browser View.

DHTML_menu is the worst, it causes the Submit button to fail in the default Media Browser View.

If I add to the image File Type, an Entity Reference to an article. Then add in the Media Browser View a relationship to that entitity reference, and then add a filter to the title of the related article entity reference - I find 4 modules that cause the Submit button to fail.

  • Administration Development Tools
  • Contextual Links
  • Media_youtube
  • Devel

If I disable any one of these four modules and leave the other three enabled then the Submit button works ok. I can even have two Media Browser Views defined and the Submit button still works.

So the easy solution for me is to disable the Administration Development Tools module (not sure when I enabled it or why) and the DHTML_menu module.

#7

Status:active» closed (fixed)

#8

Status:closed (fixed)» active

I wouldn't consider this fixed. Many of us need those modules working and still be able to use the media views selector :)

Update: I have tried disabling al of the mentioned modules and I still cannot get the save button to work. Tried multiple themes bartik, seven and rubik

#9

Status:active» postponed (maintainer needs more info)

@kclarkson the media browser relies on JavaScript so any JS errors will prevent the browser from working. Have you checked your JS console log to ensure that your themes/modules aren't causing any errors?

#10

@Devin Carlson,

Unfortunately I never figured out what was causing my errors.

I updated Core, updated all Media modules to most recent dev and updated the Rubik admin theme to the most recent dev version and cleared my cache.

I also updated my MAMP's php.ini file to increase the amount of memory. I thought that I had fixed this but found out that I needed to update my .bash_profie file in my home folder with the following so that it pointed to the correct php.ini export "PATH=/Applications/MAMP/bin/php/php5.3.6/bin:$PATH"

Good luck to anyone else who finds this issue.

#11

I would like to confirm this issue. I am unable to select any media files from the media browser view in the pop-up... I have turned off all the modules cited above and removed all JS from my theme, I have switched to bartik on the front end and tried seven on the backend.

I have tried chrome, firefox and safari...

Unable to select a media file...

#12

Since clicking on a file doesn't select it. I thought adding a VBO field to the browser view would be way to select a file to act upon... however, the view-mode "media-browser" is hard coded....

#13

Same problem. Images can be selected just fine. Selecting a document however gives me the error described above.

Looking at Firebug on the browse files popup, the html looks different on a document vs. image. On an image, there is just one outer link that contains <div class="media-item">

On a document however, there are 2 additional links. One is within <div class="media-item"> and one is within <div class="media-thumbnail">.

That doesn't seem right to me.... perhaps the duplicate links are causing issues?

#14

Priority:normal» critical

Marking this as critical as files of document type simply cannot be selected through the media browser and submitted. Uploading new files as a workaround would just create duplicates of files that already exist.

#15

Status:postponed (maintainer needs more info)» needs review

I've provided more info... I installed same versions on another site and the problem is easily reproduced. I've narrowed it down to document type of item in the browser. Images work fine... I can't find errors however. I'm hoping someone can figure this one out.

#16

I have same on my website. "select media" button just don't work.

#17

anybody have a solution for this issue?

#18

Status:needs review» active

i see no patch
btw..there is either a js error, or the js events are not binded..can someone check if the submit button or the form all together has any event binded on it?

#19

I had/have a problem very similar to this in that media won't submit, and media youtube on submission freezes and doesn't complete.

The difference was that it was working fine on our dev site which is almost identical.

I managed to get it a youtube video to embed, but switching off secure pages, embedded the video and then turned it back on again afterwards.
Not a solution, just got the video to work.

So possibly there is something happening related to https or something?
If I find out anything more will come back here, if it is related to other people's issues.
Are we seeing this problem on secure sites or everywhere?

#20

We found the following causing the problem:

media.popups.js.

Drupal.media.popups.mediaBrowser.mediaBrowserOnLoad = function (e) {
  var options = e.data;
  if (this.contentWindow.Drupal.media.browser.selectedMedia.length > 0) {
    var ok = $(this).dialog('option', 'buttons')['OK'];
    ok.call(this);
    return;
}
};

This is because the page is https but the ajax call goes to http://www.example.jp/en/media/browser?render=media-popup&types... etc

Which causes this error:

Unsafe JavaScript attempt to access frame with URL http://www.cblh.jp/en/media/browser?render=   ----  from frame with URL https://www.blah.jp/en/node/add/news.  The frame requesting access has a protocol of 'https', the frame being accessed has a protocol of 'http'. Protocols must match.

If the page is https, Media tries to call the overlays on non-https and it screws up.
We fixed it by making the node edit pages non-https in secure pages.

However perhaps this is a module bug, where the overlay should be aware whether the base url is 'http' or 'https' and matches the url accordingly?

#21

Can people who are having this issue confirm that https is enabled on their site?

#22

No, its not an https issue (at least wasn't for me). Its file type of "document". I fixed my issue by specifing different view mode for document in preview. I believe large filetype icon....

#24

I believe it might be related however, i never installed any patches. I just changed the preview mode on documents to large file-type icon and that resolved it for me.

#25

If changing the preview mode is fixing this issue for people, it is likely that DamienMcKenna is right that #1743040: "You have not selected anything!" error message, when a selection has clearly been made is probably the same issue. We may want to close this issue as a duplicate of that.

#26

Is there still no solution for the "select media" button not working?

#27

The fix was committed for http://drupal.org/node/1743040 see: http://drupalcode.org/project/media.git/commitdiff/e771336e3eab2389316d2...

Can you verify if you're still having the issue?

#28

As per #20 for me this was down to secure pages messing with things, have set secure pages to ignore the media browser url "media/browser".

#29

Status:active» closed (fixed)

I'm marking this as fixed, please reopen if there are anymore issues.

#30

Status:closed (fixed)» active

Changing the error status to active.

I'm receiving the same error - and believe that it's being caused by a mix of secure and insecure content ... an https url is being used for main admin pages, and http is being used for the content served by the media module's file dialog. This is causing my javascript console to complain:

jquery.js:5541
Unsafe JavaScript attempt to access frame with URL http://www.example.com/media/browser?render=…rces&file_extensions=pdf&max_filesize=&uri_scheme=public&plugins=undefined from frame with URL https://www.example.com/node/add/resource. The frame requesting access has a protocol of 'https', the frame being accessed has a protocol of 'http'. Protocols must match.

This results in an inability to select any files in the library browser. I'll report back when I find out more.

#31

Status:active» closed (fixed)

Please file a new bug report for your specific bug.

#32

@Dave Reid

I believe this is the same issue. #20 and #28 raise the same concern.

Are you certain I need to open a new issue? Happy to do so if required.

#33

@Dave Reid

I believe this is the same issue. #20 and #28 raise the same concern.

Are you certain I need to open a new issue? Happy to do so if required.

#34

@lukus - your post in #30 I think means that we are not rendering the iframe with the correct protocol. I think this thread has been a mix of two different issues, one of which has been solved. Would you mind opening a new issue specifically for the https issue?

#35

I can confirm this is still not working.

But I'm in version = "7.x-1.3"

When I click on the submit button, I get a whole bunch of javascript errors.

here's what I'm clicking on screenshot : http://alphex.com/z/media_submit_broke-20130506-170541.jpg

here's the JS errors in chrome : http://alphex.com/z/js_errors-20130506-170701.jpg

Any fixes to this... (The cancel button, of course works... )

#36

Version:7.x-2.x-dev» 7.x-1.3
Component:Media Browser» WYSIWYG integration

i got exactly bug with alphex

#37

This has to do with the CKEDITOR module.

I just downgraded from the latest release of CKEDITOR 1.13, to 1.12, and it solved my problem.

I'll go comment on that project issue queue...

#38

Status:closed (fixed)» active

i don't know if it's still the same issue or different. i use media version 7.x-1.3 and wysiwyg 7.x-2.x-dev after i set the file type as seen from http://drupal.org/files/file-type-wysiwyg-media-error.png i cant press the submit button for that image as seen from http://drupal.org/files/media-wysiwyg-error.png

Please inform me if i need to open new issue.

AttachmentSizeStatusTest resultOperations
media-wysiwyg-error.png147.67 KBIgnored: Check issue status.NoneNone
file-type-wysiwyg-media-error.png152.23 KBIgnored: Check issue status.NoneNone

#39

Status:active» closed (fixed)

ignore. #38 is duplicate of #1983652: Unable to insert media image from library as link

nobody click here