For some reason, as an anonymous user, when I visit a form which has both entity reference with pre-populate, and also a file upload, when I use the file upload field (which ajax submits), on the next submission of the form the entity reference field which is pre-populated is now empty.
I've had a look and it seems that the form is manipulated on ajax submit for the file upload, and because the URL doesn't have the GET vars which prepopulate looks at, clears the field. On the next submission/load of the form, this empties the field.
I'm not too sure how to go about this, but I've found that by making the function entityreference_prepopulate_get_values_from_url
aware of this, we could grab the info needed for prepopulate from $_SERVER['HTTP_REFERER']
, though I'm not sure this would be the best solution.
Any help would be welcome, thanks! :)
Comments
Comment #1
kvit CreditAttribution: kvit commentedI'm using Entity Reference field with Prepopulate and Disable Field action in content with an Image field.
When an authorized user goes to the link to create a prepopulated form he sees the right value of Entity Reference in the Form. But if he uploads an image and saves, Entity Reference field is empty.
So, the issue is also for authorized users except user #1.
And for dev. version either.
Comment #2
amitaibuThere's already code to make sure we don't try to capture values while in ajax, in
entityreference_prepopulate_field_attach_form()
:It seems to work for me on my use case, so I'll need more info / patch
Comment #3
kvit CreditAttribution: kvit commentedSo, is it done intentionally that Entity Reference Field is emptied if ajax is used?
Sorry, I'm not a coder and can't help with patches.
Just one more notice: if I use "do nothing" action setting, Entity Reference Field can survive file upload.
File upload empties Entity Reference Field when "hide field" or "disable field" action is set for this field.
Comment #4
klucid CreditAttribution: klucid commentedConfirmed that I have the same issue. Any ideas so far?
Thanks guys!
Comment #5
klucid CreditAttribution: klucid commentedIf there is anyway we can resolve this issue, I would appreciate it. If funding is needed, please let me know.
Comment #6
klucid CreditAttribution: klucid commentedAny progress on this? I would appreciate some help and am willing to pay for a patch to get this working.
Thank you!
Comment #7
ezheidtmann CreditAttribution: ezheidtmann commentedI'm also experiencing this issue. I'll see what I can do in the way of patches or simple test cases.
Comment #8
ezheidtmann CreditAttribution: ezheidtmann commentedSo it appears that
entityreference_prepopulate_field_default_value()
was being called during the ajax submission step, but not called again on the "real" form submission. The empty value from the AJAX step was being cached, resulting in the field being empty on submission.This patch sets
$form_state['no_cache'] = TRUE
in the AJAX step so that the form is rebuilt on submission. Patch is against 7.x-1.x.Comment #9
amitaibuSetting correct status, for testbot.
Comment #10
amitaibuTestbot, wake up!
Comment #11
amitaibuI've changed it to
$form_state['rebuild'] = TRUE;
and committed. Thanks.Comment #12
gthing CreditAttribution: gthing commentedI've installed the latest dev version and am still having the same issue.
Comment #13
gthing CreditAttribution: gthing commentedConfirmed with version 7.x-1.1+4-dev
Tried clearing caches, cron, updates, etc. without luck.
Comment #14
amitaibu@gthing , Please re-test using latest dev from GIT (as Drupal might not have packaged the fix in the new dev yet)
Comment #15
gthing CreditAttribution: gthing commentedGrabbed the latest snapshot and updated. Same issue still there.
Comment #16
ezheidtmann CreditAttribution: ezheidtmann commentedAmitaibu, I'm unable to test today but $form_state['rebuild'] = TRUE may not work -- see the form_set_cache() call here:
http://api.drupal.org/api/drupal/includes%21form.inc/function/drupal_reb...
Comment #17
amitaibuI see. Committed #8, thanks.
Comment #18
gthing CreditAttribution: gthing commentedConfirmed working. Thanks!
Comment #19
gthing CreditAttribution: gthing commentedI am now having a new issue. I am fairly certain this cropped up with the fix above, and disabling the entity reference prepopulate module makes the problem go away.
I have a field that allows multiple file uploads. The first file upload works fine, while the second file upload causes the form to save, then breaks the upload form from allowing further uploads. Saving the node at that point will cause a duplicate entry error.
Screenshots:
First upload works as normal: http://i.imgur.com/x9wZh.png
Second upload causes form save (message in fileupload form, not at top): http://i.imgur.com/zgOyL.png
I have duplicated this issue on two sites.
p.s. Should this be a new issue?
Comment #20
ezheidtmann CreditAttribution: ezheidtmann commentedHowdy, I've been able to duplicate this issue on my installation. I'll let you know if I figure out a solution.
Comment #21
amitaibuOk, thanks for the report -- I've reverted the fix until we find a proper one.
Comment #22
amitaibuBut don't be discouraged by that @ezheidtmann :)
Comment #23
gthing CreditAttribution: gthing commentedShoot. Are there any workarounds for getting this functionality? Other modules? I'm in a bit of a bind here.
I will put $40 down for a solution by the end of the week. I know it's not much but as I said, I'm in a bind.
Comment #24
klucid CreditAttribution: klucid commentedI was able to get this to work using the latest version (1.1). It seems that the "do nothing" setting on the field is now working properly and the entity referenced is populated properly (in my case it is an Organic Group).
Hope this helps.
Comment #25
gthing CreditAttribution: gthing commentedI will offer $100 via paypal to whoever can fix this by Nov 5th. $25 if you can describe a reasonable workaround.
Comment #26
Drave Robber CreditAttribution: Drave Robber commentedAJAX file upload needs cached form state in order to work - see ajax_get_form(); what #8 achieves is that it simply pulls data cached earlier during the initial build.
(If you move
$form_state['no_cache'] = TRUE
line outside ofif
statement, file upload will stop working altogether as there will be no cached data for thisform_build_id
at all.)As for the original issue, I was unable to reproduce it on a clean install, using entityreference_prepopulate 7.x-1.1 and core Image field; hence, there probably are missing pieces in this puzzle. Someone who has had this issue might want to try reproducing it on a clean install and then adding modules one-by-one until you get it.
Comment #27
mesch CreditAttribution: mesch commentedUsing 7.x-1.1 with an up-to-date Drupal instance, I couldn't replicate the original issue nor the issue raised in #19. I tried using file and image fields with multiple values permitted.
I did encounter another issue though. If the form has an error during submit, the entity reference field goes blank. If I disable entityreference_prepopulate, the entity reference is retained when the form is submitted with errors.
Comment #28
gthing CreditAttribution: gthing commentedI've done some more testing and it looks like the original issue show up only if you set the pre-populate field to "hide." Setting it to "do nothing" makes it work as expected. Rolling back to 7.x-1.1 fixed the issue raised in #19.
In my case I would like to hide the field, but I supposed I could do that in CSS.
If anyone can reproduce the bug with that tidbit I'll still offer the bounty because it would be cool to have this bug fixed.
Comment #29
Drave Robber CreditAttribution: Drave Robber commentedUnable to reproduce the original issue with 'hide' either. (tried with 'disable' earlier)
Are you using core Image only, or is there something else in play (multiupload modules etc.)?
What other fields are there on this content type?
What other modules could be interfering?
It seems the original issue might depend on some common module (as several more people are having it), but we still do not know what the trigger is.
Comment #30
ezheidtmann CreditAttribution: ezheidtmann commentedHi Drave Robber,
I was able to reproduce the original issue with just ctools, entity, entityreference, and entityreference_prepopulate in addition to core. To the default "article" content type, I added a file attachment field and an entityreference field with entity type set to "node". I will try to reproduce with the latest HEAD if I have time today.
Comment #31
Drave Robber CreditAttribution: Drave Robber commentedI finally reproduced the initial issue.
There is one more condition: the entity field must be required. If it's not required, it saves all fine and dandy. Weird.
Comment #32
ndeschildre CreditAttribution: ndeschildre commented@Drave Robber: Thanks a lot! Finally able to reproduce...
Please find attached a patch fixing this issue. (Patch against 7.x-1.1, as I understood 7.x-dev introduced another bug, cf @gthing)
The issue was that on form rebuild on AJAX, #access was set back to true (while it was set to false on this bug use case (field hidden)), and my guess is that subsequentely it asks again for the default value, and the $_GET arg being not here, we end up with an empty value.
I must admit I don't have the full logical explanation on why it works now, I just did that in an hurry last half hour ;)
It also keeps on working in the field-not-required scenario.
Enjoy!
Comment #33
ndeschildre CreditAttribution: ndeschildre commentedComment #34
gthing CreditAttribution: gthing commentedTested. Still having the original issue with field required and set to hide.
Comment #35
mesch CreditAttribution: mesch commentedA patch is attached. It works under all three "Action" options on my development server.
As I see it, the issue is that when the form was being rebuilt via AJAX,
entityreference_prepopulate_get_values_from_url
did not have the initial $_GET parameters available to populate the reference fields so they were empty. When the form was ultimately saved, the original values were not accepted because either#access = FALSE
or#disabled = TRUE
for those fields.What I did to fix this is store the relevant $_GET parameters in persistent storage when the form is first loaded. Each time the form is rebuilt via AJAX, the original parameters are now available. This was fairly tricky, since a unique identifier wasn't available in the form builder or the
entityreference_prepopulate_get_values_from_url
function. I had to create an after-build function, and then populate persistent storage (I chose sessions, but you could just as easily use the db) there.Feedback is most welcome... I'm tired and may see issues with this tomorrow, but I wanted to get in under gthing's deadline :P.
Comment #36
amitaibu@MEsch ,
Thanks for working on this.
I think it's best to use the $form_state itself in the after build, and then in
entityreference_prepopulate_get_values_from_url()
call ajax_get_form() if we are inside an AJAX request.Minor: you have trailing spaces (use Dreditor to see them).
Comment #37
ndeschildre CreditAttribution: ndeschildre commentedDoes not fix for you? It does for me ;)
So that could be that you are in a sub-usecase of this bug..
Oh well. If @MEsch solution works, that's great.
Comment #38
ezheidtmann CreditAttribution: ezheidtmann commented@MEsch, thanks for writing that. I'm going to re-write to use form_state and test. Stay tuned!
Comment #39
ezheidtmann CreditAttribution: ezheidtmann commented@MEsch, your patch has whitespace errors and does not apply. I'm applying your changes manually, but please do take care to avoid this in the future. see: http://drupal.org/node/707484
Comment #40
gthing CreditAttribution: gthing commentedDoes #35 this patch 1.1 or should I apply it to the previously patched module?
Comment #41
ezheidtmann CreditAttribution: ezheidtmann commentedgthing: I believe it applies to 1.1, but I've only tried against 7.x-1.x, where it fails.
Comment #42
gthing CreditAttribution: gthing commentedI couldn't get it to apply to 1.1, 7x-dev, or the previously patched module.
Comment #43
mesch CreditAttribution: mesch commentedPatched again, patch deploys on my development server. Patch applies to 7.x-1.1.
Comment #44
gthing CreditAttribution: gthing commented@MEsch
Tested against 1.1 and found it working in all of the above use cases. Huzzah!
PM me your paypal address
Comment #45
mvcthis isn't the cleanest solution but this works for me. thanks, MEsch.
Comment #46
rogical CreditAttribution: rogical commented#43 works for me!
Comment #48
FiNeX CreditAttribution: FiNeX commented#43 works fine on 7.x-1.1 version and with a required ER field. Thanks
Comment #49
kpv CreditAttribution: kpv commentedThis one uses chached form. Applies to 7.x-1.1.
Comment #50
kpv CreditAttribution: kpv commentedComment #52
a.ross CreditAttribution: a.ross commentedLooks like there are two approaches being worked on in parallel here. Both patches need work, though. The one in #49 doesn't apply to 7.x-dev and seems to require that $langcode be passed to the edited function, and the patch in #43 has coding style issues.
I'm not sure which approach is conceptually better, though.
Comment #53
a.ross CreditAttribution: a.ross commentedLooks like another issue of both patches is that they don't cater for Ajax requests using GET, see: http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.ht...
Anyway, here's a patch in the style of #43, as I think it makes more sense to use the form cache. It fixes the problem with translatable fields, which required adding an extra parameter to 2 functions to be able to pass $langcode. It may be possible without that, because the entity object also contains the language. Not sure what is preferable.
I'm not sure why the patch in #43 mentions that a field may not be in the root of the $form array. I tested using the field_group module, and it just works. But please do review.
Comment #54
amitaibuWhy do you set a default vale for langcode? Anyway it should be
LANGUAGE_NONE
, not 'und'Missing dot in end of line. Also would be nice to have more comments about what the problem is and why we chose to solve it like this.
better surround this with an !empty() to prevent notices. It seems pretty fragile. At this state won't we get the default value in the $form_state?
Comment #55
amitaibuSetting correct status.
Comment #56
amitaibuI'll be working on this.
Comment #57
amitaibuThis patch also works for OG, using a recursive function to extract all the
#default_values
from the cached form.Comment #58
amitaibuPlease let me know if it works for you.
Comment #59
a.ross CreditAttribution: a.ross commentedI haven't tested the patch yet, I will do so when I get back to work on monday, but here is a preliminary review.
I see you copied an error I made, the superglobal $_POST is always set, so this test is redundant.
Also, the patches have so far haven't addressed AJAX requests using GET, as rare as that might be. IMO it should be, otherwise this issue might come up again in the future.
If you are passing the $target_ids array by reference, why are you returning it?
Comment #60
amitaibu@a.ross, Thanks for the good review. I've attached also the interdiff.
> Also, the patches have so far haven't addressed AJAX requests using GET, as rare as that might be.
That's indeed sounds pretty rare -- I know Views for example changes $form['#method'] = 'get' on it's exposed filters, but that's not the case when submitting a new entity. Anyway, I think it's ok if it will be a follow-up patch if needed.
Comment #61
Angry Dan CreditAttribution: Angry Dan commentedHi,
I'm new to this issue and apologies if this patch duplicates work already done, but sometimes it's good to have a fresh set of eyes on things.
My approach was to use the $form_state cache to hold URL pre-populated values and then re-read them from there in the situations where they cannot be read from the URL, such as requests to /ajax.
I am wondering if part of the problem is coming from using
'#access'
when disabling the form elements. I wonder if there is anything better we could do here?Comment #63
a.ross CreditAttribution: a.ross commentedAlright, back to work and tested the patch first thing. Patch is not working yet for me, I'm not using OG. A few comments:
LANGUAGE_NONE ;)
Unless you set stuff in the $_GET array yourself, there's no need to test for it here. Testing $_POST should be sufficient. You're also testing $_GET[$field_name] below.
This only works when using OG (which I'm not using). But something else is wrong. When I add
module_exists('og')
I get this error: "Field [field_name] must be populated via URL."Comment #64
amitaibuHaven't tested, but from review:
I like this approach :)
Remove
Don't return here, just assign it to $ids -- to let it be processed along the function
Also make sure ti create a diff that can be applied (git diff)
Comment #65
amitaibu@a.ross see #61 and #64
Comment #66
a.ross CreditAttribution: a.ross commentedWorking on it
Comment #67
a.ross CreditAttribution: a.ross commentedAre you sure that the cache should be passed on to the rest of the function? I think it already went through there when the $ids were first cached in the $form_state, does it have to be done again?
Patch works for me, here's a git diff with some slight modifications.
Comment #68
a.ross CreditAttribution: a.ross commentedComment #69
amitaibu> Are you sure that the cache should be passed on to the rest of the function?
Yes, as we want it to reach
entity_access()
and$items[] = !$flat_array ? array('target_id' => $id) : $id;
Comment #70
a.ross CreditAttribution: a.ross commentedAlright, I get it. Here's a patch that fixes that issue. I had to restructure the if clauses a bit, I think I got it right, but please do review.
Comment #71
joachim CreditAttribution: joachim commentedI was getting this problem with a custom AJAX behaviour on a form element.
Confirming that the patches fixes the problem for me.
Comment #72
joachim CreditAttribution: joachim commentedOne thing though -- do we really need to get the form back out of cache?
I have some custom prepopulation code for another part of the same form, which is also affected by this problem, and what seems to be working is putting it in the $form_state when I can find it in the URL, and then just retrieving it from that next time around.
Comment #73
a.ross CreditAttribution: a.ross commentedThat patch does store the values in $form_state, but that variable isn't passed to the function where the values are retrieved. We could fix that, however.
Comment #74
JurriaanRoelofs CreditAttribution: JurriaanRoelofs commentedI'm currently hiding the file upload button so that files don't get Ajax-uploaded. Works as a temp fix but would appreciate a patched release.
Comment #75
guy_schneerson CreditAttribution: guy_schneerson commentedA temp fix is not to hide or disable the field in the field configuration (i.e. action = do nothing) and do it in a hook_form_alter as follows:
I am using a modified version of the above where the value is copied to the title before it disabled.
Thanks to all involved for looking at a proper solution and hope this gets resolved soon.
Comment #76
a.ross CreditAttribution: a.ross commented@Amitaibu, do you think this is this ready to go in?
Comment #77
amitaibuCommitted, thanks all!
Comment #78
sw3b CreditAttribution: sw3b commentedI getting error with the latest DEV could it be related to this patch ?
Comment #79
a.ross CreditAttribution: a.ross commentedPlease open a new issue for that unless you're sure it was caused by the patch in this one.
Comment #80
heylookalive CreditAttribution: heylookalive commentedHi, for some reason this exact issue still happens for me when working from latest dev. With the entity ref field set to hide when populated via URL if I test it without submitting an ajax file upload it works fine, if I try with a file upload via ajax it fails. Key difference for me possibly is that this is field is an OG group audience ref.
Comment #81
tjhart87 CreditAttribution: tjhart87 commentedI can confirm the error reported in 78 above is caused by this patch. I received it today after patching. See below:
Notice: Undefined variable: ids in entityreference_prepopulate_get_values_from_url() (line 280 of /var/www/ubind7/sites/all/modules/entityreference_prepopulate/entityreference_prepopulate.module).
Recoverable fatal error: Argument 1 passed to EntityReference_SelectionHandler_Generic::validateReferencableEntities() must be an array, null given, called in /var/www/ubind7/sites/all/modules/entityreference_prepopulate/entityreference_prepopulate.module on line 280 and defined in EntityReference_SelectionHandler_Generic->validateReferencableEntities() (line 193 of /var/www/ubind7/sites/all/modules/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php)
The odd thing about this error is I only receive it on one of my content types. Any ideas?
Comment #82
mrfelton CreditAttribution: mrfelton commentedAlso getting this error when trying to create an og group node that where the group audience field is prepopulated via the url, and the field is set to be hidden. 1.2 does not have this problem.
Comment #83
amitaibu@a.ross, can you check that please? :)
Comment #84
tjhart87 CreditAttribution: tjhart87 commentedIt appears to me that the error is occurring on content that doesn't have an ajax load now. All content types with a load are working.
Comment #85
a.ross CreditAttribution: a.ross commentedHm, that's funny. In my testing environment, it works for regular users, but it doesn't work for admin users. The difference between the two is that the field isn't actually hidden from the admin user. I guess in that instance, the values can just be taken from the form submit and don't need to be taken from the form cache. Something must be happening in this case that prevents the values from being stored in the $form_state in the first place. Amitaibu, do you have a suggestion?
A bit unrelated, but I found another potential issue, which is that in this construct:
... you would want to do this before returning (or at least that was what happened before the patch):
The patch that follows is just a workaround, not necessarily a real fix. It does prevent the error in my case.
Comment #86
a.ross CreditAttribution: a.ross commentedComment #87
sw3b CreditAttribution: sw3b commentedWork for me thanks a lot !!!
Comment #88
sw3b CreditAttribution: sw3b commentedthe only thing i notice is for user who has not admin permision it loop back again on my side
Comment #89
a.ross CreditAttribution: a.ross commentedOn my end, it works for both regular and admin users. Can you describe the problem in more detail?
Comment #90
sw3b CreditAttribution: sw3b commentedIt does a loop has describe at the top of the issue and a message appear saying that no item has been selected and i must select on value to continue.
Comment #91
a.ross CreditAttribution: a.ross commentedDo you mean the error message you posted in #78?
Comment #92
sw3b CreditAttribution: sw3b commented#75 is not mine but the error i was getting in #78 and with the DEV is solve by your patch for my admin.
On another side the users who only have permission to creates nodes have the same problem describe before the latest dev version. it does a loop. After that if i select the reference manually it work. But when it is prepopulate it does not work.
Comment #93
a.ross CreditAttribution: a.ross commentedSounds like the value isn't stored in the form_state. Are you using OG?
Comment #94
sw3b CreditAttribution: sw3b commentedNot for that node creation. On another section of the site yes but not for that.
Comment #95
a.ross CreditAttribution: a.ross commentedOk, what are the settings of that entityreference field? I need to be able to reproduce the problem in order to fix it.
Comment #96
sw3b CreditAttribution: sw3b commentedField title: Gallery
Fiel name: field_gallery_entityreference
Entity Reference
Select list
The Entity reference prepopulate checkbox is mark and the field is on disable. Apply action is not mark. Fall back is to do nothing and the permission for the skip access is set to Administer content. Og context none.
I also have a view to generate the list of entity and restrict to the entity the user and only the user have access. If you want acces to my dev site just let me know in private message. maybe it could be easy that way for you.
In general i'm using Upload Nodes (sandbox) to upload multiple images into a gallery. Without prepopulate module everything work great. Just let me know if you want a copy of the module or have another question or test to do.
Comment #97
tjhart87 CreditAttribution: tjhart87 commentedIs the patch in 85 a fix for the error we've been discussing or is that a work around for the new potential issue you found?
Thanks for the quick work.
Comment #98
mrfelton CreditAttribution: mrfelton commentedThe patch in 85 gets things working for me with an OG group audience field set to prepopulate from the URL, on a content type that does *not* have any kind of ajax field.
Comment #99
amitaibuI've changed it a bit, so we don't call the selection handler if there are no IDs.
Committed, thanks.
Comment #100
a.ross CreditAttribution: a.ross commented@Sw3b I can't reproduce the problem you're having with those settings. It would seem likely that there is a conflict with the other module you mentioned. And since it's a sandbox project I don't think we can do a lot about that issue.
@tjhart, the patch included both.
Comment #101
danylevskyiLatest commit causing errors:
#1916496: IDS problem with latest dev version
Comment #102
a.ross CreditAttribution: a.ross commented@Amitaibu, the reason I used
empty()
instead of an implicit cast to boolean, is that the cast will cause a notice when the variable is undefined, which was what was happening here. This should do it:Comment #103
amitaibuCommitted, thanks.
Comment #104
a.ross CreditAttribution: a.ross commentedPlease don't bump the priority -_-
Comment #105
a.ross CreditAttribution: a.ross commentedOops, sorry crosspost
Comment #106
tjhart87 CreditAttribution: tjhart87 commented#102: entityreference_prepopulate_ajax_submission-1502972-102.patch queued for re-testing.
Comment #107
tjhart87 CreditAttribution: tjhart87 commentedPatch failed earlier testing ... is 102 the committed patch?
Comment #109
a.ross CreditAttribution: a.ross commentedWell of course it will fail, since it's already committed.
Comment #110
tjhart87 CreditAttribution: tjhart87 commentedhaha thanks smarty. Wasn't paying attention.
Comment #111
tjhart87 CreditAttribution: tjhart87 commentedAlso didn't see the status change ... It's been one of those mornings.
Comment #112
a.ross CreditAttribution: a.ross commentedWhat a morning without coffee? :)
Comment #113
tjhart87 CreditAttribution: tjhart87 commentedI can use some coffee .. ok i'm still having a problem. With the ajax load it works but for the other content it is still failing to load from URL. I receive this message: Field Groups audience must be populated via URL.
Any ideas?
Comment #114
a.ross CreditAttribution: a.ross commentedAlright, I have been able to reproduce the problem. What happens here is that when the form is submitted, a POST request is sent, containing the
form_build_id
. The prepopulate values are available in the$_GET
superglobal as usual, though, so no need to get it from the form_state. In fact, when we try to get the form out of cache in this case, it's empty! So that's where the problem arises. Attached is a proper fix. I also added a bit of documentation to make it clear what the various if/else constructs mean. I also took the liberty to correct an unclear sentence (the last line in the diff), sorry about that.Comment #115
a.ross CreditAttribution: a.ross commentedComment #117
a.ross CreditAttribution: a.ross commentedApplied against latest dev
Comment #119
a.ross CreditAttribution: a.ross commentedGah, something went wrong there. Try again.
Comment #120
danylevskyiI have checked #119 patch.
After submitting entity with entityreference_prepopulate field I am getting next message:
Field Plan Document must be populated via URL.
PHP notice gone.On create page field works great. I mean disable or hide actions work.
Comment #121
danylevskyiSorry, #120 is wrong comment. After applying #119 there is no errors after submitting node.
Comment #122
a.ross CreditAttribution: a.ross commentedAlright, good news! Thanks for testing
Comment #123
tjhart87 CreditAttribution: tjhart87 commented@a.ross Thanks for turning this around for us! We will report back as soon as we've applied the patch.
TJH
Comment #124
tjhart87 CreditAttribution: tjhart87 commentedWe are having issues applying the patch to the 7x 1.2 branch. Will this patch work there or is it specifically for dev?
Comment #125
tjhart87 CreditAttribution: tjhart87 commentedWhich patch order should we attempt to the base 1.2 version to correctly patch the error?
Comment #126
tjhart87 CreditAttribution: tjhart87 commentedWe finally were able to apply the patch manually. Since we hadn't followed the sequence of previous patches it was getting rejected. Test look good so far. Thanks a.ross
Comment #127
a.ross CreditAttribution: a.ross commented@tjhart, glad it's working for you, but the patch should apply to the latest -dev really.
Comment #128
a.ross CreditAttribution: a.ross commentedbump
Can this be committed? 3 people have tested the patch, including me, and there haven't been any problems yet. Thanks
Comment #129
amitaibuCommitted, thanks.
a.ross, can you ping me on IRC, I'd like to ask you something.
Comment #130
sardara CreditAttribution: sardara commentedHi,
the patch works great. But it's missing the code to make it work when "og context" option is active.
I have a file/image upload form in a group panel page, so I use og_context to prepopulate.
I've created a small patch, I'll upload it to review (probably needs refactoring).
Comment #131
amitaibua.ross, this one is yours... :)
Comment #132
a.ross CreditAttribution: a.ross commentedI can't really dive into this because I've got a deadline to meet and we're not using OG, so it'd cost me a bit more time than usual. But the patch looks ok at first sight.
Comment #133
weri CreditAttribution: weri commentedI have the same problem:
I updated to the latest dev version and applied the patch from #130. But it doesn't fix the problem.
Comment #134
weri CreditAttribution: weri commentedI do some debugging and found the problem in the following function:
When i remove the part with the check
if (empty($instance['field_mode']))
it works:When I upload the image in the node, the function is called with a field_mode default, when i save the node after upload, the function entityreference_prepopulate_og_field_default_value() is called again but field_mode is not set.
I hope this information helps to fix the problem.
Comment #135
tatyana CreditAttribution: tatyana commentedSame problem here, latest dev and patch 130 do not fix the issue
Comment #136
BrightBoldSame as tatyana — latest dev and patch from #130 did not solve the problem. If I comment out the lines referenced in #134 (which obviously the commenter is not suggesting as a solution, but I thought I'd try it to see what happens), the entityreference field does retain the group reference.
However, I'm using Auto Nodetitle to pull the group name into the content title, and with this configuration the group name does not get pulled through into the title, so I get the token instead (e.g., my title is "[node:field-organization] 2012-13 Project Application"). If I don't upload a file, then the auto nodetitle works fine.
Comment #137
amitaibuI've done some module cleanup in #1958800: AJAX causes entityreference_prepopulate_get_values_from_url to fail, which should also fix the OG problem, so if people can test that patch it would be great.
Marking this issue as duplicate
Comment #138
heddnAttempting to solve this thing over in #1958800: AJAX causes entityreference_prepopulate_get_values_from_url to fail.
Comment #139
RUPESHDS CreditAttribution: RUPESHDS commented$form_state['no_cache'] = FALSE;