I open a node create form
I click "select media" for the media field
I choose upload
I tried to hit submit once I chose my image but nothing happened
I clicked upload
the image was uploaded (but it was a generic file type and not the image)
once I clicked upload I got the error message

here is more detail as I had devel on
Notice: Undefined index: callback in ajax_form_callback() (line 379 of drupal-7.15/includes/ajax.inc). =>
... (Array, 4 elements)
3: ajax_form_callback() (Array, 2 elements)
file (String, 21 characters ) includes/ajax.inc:379
args (Array, 0 elements)
2: call_user_func_array() (Array, 1 element)
args (Array, 2 elements)
0 (String, 18 characters ) ajax_form_callback | (Callback) ajax_form_callback();
1 (Array, 0 elements)
1: menu_execute_active_handler() (Array, 2 elements)
file (String, 21 characters ) includes/menu.inc:516
args (Array, 0 elements)
0: main() (Array, 2 elements)
Krumo version 0.2.1a | http://krumo.sourceforge.net Called from /var/aegir/platforms/7/servers/drupal-7.15/includes/ajax.inc, line 379

Comments

dmitry.kischenko’s picture

I have the same problem.
After submitting form I get Notice: Undefined index: #ajax in function ajax_form_callback() (string 379 at file includes/ajax.inc).

operations’s picture

Finally, I got it to work .. I was getting the "Notice: Undefined index: #ajax in ajax_form_callback()" error for ages and I googled google to find a solution to my problem but in vain!

I have the below situation:

  1. Drupal 7.20
  2. Entity reference prepopulate - to populate a dropdown entity reference field
  3. Two Entity reference fields (checkboxes) with views filtering enabled (entity reference display)
  4. Hook form alter to add ajax functionality and more

The issue: I wasn't able to bind the two entity reference fields together using #ajax. The $form_state['triggering_element']['#ajax'] array wasn't available in ajax.inc ajax_form_callback.

The reason: I was restricting access to the scope of code that adds the #ajax to the desired field.I was checking a $_GET parameter for the entity reference prepopulated field at the beginning of the form alter. This causes the ajax request (path: system/ajax) to not access the code and not rebuild the form again with #ajax property. So check that the ajax request when executed it sees the ajax code again. This is my understanding so far cause when I added the below it worked perfectly:

if (isset($form_state['input']['my_ajax_field_name']) || isset($_GET['my_get_parameter_name'])) {

Though I think the best practice is to set the path in the #ajax array to something like 'system/ajax?nid=nid' which I'm still not being able to do.. cause the ? char gets wrong. Any ideas?

Devin Carlson’s picture

If you're using file or image fields, this should now be fixed with #2187837: Bring media element and field widget inline with managed_file equivalents.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

hasmimeraj’s picture

On form submit i am getting error Notice: Undefined index: #ajax in function ajax_form_callback() (string 379 at file includes/ajax.inc).
And form is not submitted. I am getting this error after updating media module from Version: 7.x-2.0-beta1+10-dev to Version: 7.x-2.0

Any help would be appreciated.

hasmimeraj’s picture

Media version is 7.x-2.20

joseph.olstad’s picture

Make sure you run update.php after upgrading
what version of file_entity are you using ? You should use the latest release.

clear caches after update.

What version of jQuery are you using? Try switching themes to bartik temporarily and re-test. You can also optionally allow the media browser to use the admin theme, there's some options in the media settings for this.

seems like something custom you've got that is interfering. Review my suggestions and please follow up.

joseph.olstad’s picture

from the media project page:

Drupal 7 installation

Pre-installation/upgrade: run the duplicate module fixer module to make sure that you do not have duplicate copies of modules on your site.
Quick install: Follow this recipe (includes troubleshooting tips), or see online installation documentation.

hasmimeraj’s picture

I am using latest stable version of file entity(version: 7.x-2.22). When i compare with older version, i found that on fourth step of file upload form in media browser, form is being submitted by ajax. So when there is ajax call to submit form, it throw error

Notice: Undefined index: callback in function ajax_form_callback() (string 395 at file includes/ajax.inc).

I have noticed ajax-processed class on submit(fourth step) button. Which was not available on previous version of file entity form.

joseph.olstad’s picture

Are you using multiform as well and plupload ? and the media submodule for bulk uploading?
if so, what versions?
Could you perhaps open a new issue and link it to here, I'd rather not re-open this issue as it might not be related even though the ajax error is the same. The ajax error you see is actually from core.
What version of core are you using? is your version of core patched?
please open a new issue and link it here, if possible, try to create steps to reproduce this on simplytest.me or with the media_dev distribution https://www.drupal.org/project/media_dev