Jump to:
| Project: | Media |
| Version: | 7.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
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
#1
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).#2
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:
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?