Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When editing entity an entity with relation select field(s):
- Press Search button in Relation Select field (page fonts change to smaller size -- as reported in comments #9 and #11 of #1307674: Notice: Undefined index: view_path in views_ajax(), line 26 of /sites/all/modules/views/includes/ajax.inc).
- Click views mini pager Next link (>>).
- JSON fills screen:
[{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"mytheme","theme_token":"lOuEaYKFtKAm46sCn63sCT3Uwyj93HKaaQCpXPwpjvY","css":[]},"overlay":{"paths":{"admin":"node\/*\/edit\nnode\/*\/delete\nnode\/*\/revisions\nnode\/*\/revisions\/*\/revert\nnode\/*\/revisions\/*\/delete\nnode\/add\nnode\/add\/*\noverlay\/dismiss-message\nuser\/*\/shortcuts\nadmin\nadmin\/*\nbatch\ntaxonomy\/term\/*\/edit\nuser\/*\/cancel\nuser\/*\/edit\nuser\/*\/edit\/*\nrelation-select\/add\/*\/*\ndevel\/*\nnode\/*\/devel\nnode\/*\/devel\/*\ncomment\/*\/devel\ncomment\/*\/devel\/*\nuser\/*\/devel\nuser\/*\/devel\/*\ntaxonomy\/term\/*\/devel\ntaxonomy\/term\/*\/devel\/*","non_admin":"admin\/structure\/block\/demo\/*\nadmin\/reports\/status\/php"},"ajaxCallback":"overlay-ajax"}},"merge":true}]
Browser location becomes:http://localhost/relation-select/ajax?vocab=All&term=&page=1&element_id=edit-field-test-relation-und-0&_triggering_element_name=op&_triggering_element_value=Search&ajax_iframe_upload=1#overlay-context=node/382
- Press browser Back button. Returns to entity edit page.
- Press Save.
- Error messages are set:
- Notice: Undefined index: _subform_element_name in relation_select_ajax() (line 883 of relation_select.module).
- Notice: Undefined index: ajax_page_state in relation_select_ajax() (line 897 of relation_select.module).
- Warning: Invalid argument supplied for foreach() in relation_select_ajax() (line 900 of relation_select.module).
Comment | File | Size | Author |
---|---|---|---|
#16 | relation_select-ajax-1730262-16.patch | 1.2 KB | Jorrit |
#7 | relation_select-ajax-1730262-7.patch | 743 bytes | Jorrit |
Comments
Comment #0.0
steveoliver CreditAttribution: steveoliver commentedPut URL in code to reveal entire address.
Comment #1
davidburnsI can confirm this error. Weird thing is that I use this field on 1 content type and get the errors. I use this existing field within a different content type and no errors. I wonder if there's conflicting JS. Still digging into this.
Comment #1.0
davidburnsFormatting.
Comment #2
steveoliver CreditAttribution: steveoliver commented@davexoxide: I notice the same thing--ajax pager works in some situations.
I think it's the Image field giving us grief...
Some testing:
Works:
Doesn't Work:
I tried this on the Not Working content type:
I tried this on the Working taxonomy term:
I conclude that the Image field breaks RS Views mini pager... :)
Comment #3
steveoliver CreditAttribution: steveoliver commentedI also noticed that
relation_select_ajax()
is being called when "Search" is pressed ...but it is also called when the pager is clicked ... only if Image field is present on page. If no image field is on page where RS pager is clicked, the RS pager does not callrelation_select_ajax
a second time.Something about Image field may be influencing/changing the callback for the Views pager?
Comment #4
davidburnsI can confirm that once I removed the image field from this content type the error went away.
Comment #5
steveoliver CreditAttribution: steveoliver commentedhmmm...
Comment #6
steveoliver CreditAttribution: steveoliver commentedHaving done a little troubleshooting, I noticed the image field and other upload field such as a file field, for example (tested), adds a
ajax_iframe_upload
parameter to the Views mini pager link.See how this parameter is used in
ajax_deliver
.Comment #7
Jorrit CreditAttribution: Jorrit commentedCould you try the attached patch? The AJAX handling in the Relation Select is not fully compatible with the Drupal mechanism that determines which CSS/JS files still have to be loaded. This fixed it for me.
The change in layout is because without the patch, Drupal thinks that the AJAX handler is displayed using the front theme, not the admin theme.
Comment #8
davidburnsI've tested this patch and it didn't get rid of the error.
Comment #9
steveoliver CreditAttribution: steveoliver commentedJorrit,
The first part of your patch has been committed in #1805098: ajax callback breaks theming.
Now we gotta figure out what's up with the Views mini ajax pager, and why it seems
ajax_iframe_upload
seems to be related to the problem.Marking needs work.
Comment #10
Jorrit CreditAttribution: Jorrit commentedI don't understand why you only committed one part, because the
exit()
in the current implementation ofrelation_select_ajax()
prevents any of the theme callback / delivery callback settings from having any effect. Did you have trouble with thereturn array('#type' => 'ajax', '#commands' => $commands);
line?Comment #11
steveoliver CreditAttribution: steveoliver commentedI committed the first part in that other issue because it resolved that issue, and the return array() in relation_select_ajax() did not fix the views pager issue.
Comment #12
Jorrit CreditAttribution: Jorrit commentedBut did it break anything?
Comment #13
steveoliver CreditAttribution: steveoliver commentedThe second part of your patch? No, it didn't break anything. But it didn't seem to fix the issue in this thread. What should be fixed with the last part of your patch?
Comment #14
Jorrit CreditAttribution: Jorrit commentedWell, it is not that important, but returning a renderable array is the "Drupal" way and it allows Drupal to run (for instance) the exit hook after your page has completed. I will also try to see if I can find the source of the views pager not working.
Comment #15
steveoliver CreditAttribution: steveoliver commentedThanks. Just trying to keep issues on topic.
Comment #16
Jorrit CreditAttribution: Jorrit commentedPlease try the attached patch. The whole iframe upload thing is invented to allow file uploads using ajax. However,
views_ajax()
doesn't work with this because it only works with button elements. The attached patch removes$_POST['ajax_iframe_upload']
for (hopefully) the right requests. The initial views request, the one that opens the popup, needs to keep using the ajax_iframe_upload method when Drupal expects this.Comment #17
steveoliver CreditAttribution: steveoliver commentedLike I said, you are the man!
#16 fixes issue for me. Committed in 314c5c6.
Thanks.
Comment #17.0
steveoliver CreditAttribution: steveoliver commentedUpdating line numbers to reflect current code.