Needs work
Project:
Autocomplete Deluxe for References
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
29 Sep 2011 at 18:03 UTC
Updated:
10 Jan 2017 at 12:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
that0n3guy commentedOh sorry, thats a big git-oops of a patch... here is a better one.
Comment #2
johnvCorrecting status.
Comment #3
john morahan commentedI added a second widget which uses the fancy tagging UI that autocomplete_deluxe provides for taxonomy reference fields.
Comment #4
mrfelton commentedUsing patches from #1 and #3. Works well, thanks!
Comment #5
john morahan commentedEntity Reference doesn't create new entities when the tags you enter don't exist, but Autocomplete Deluxe's tagging UI makes it look like it should.
So here's a patch to do that...
Comment #6
john morahan commentedWhoops - some cruft left over from a previous attempt.
Comment #7
IWasBornToWin commentedIf I want to use this with entity reference do i need to apply each individual patch?
Comment #8
john morahan commentedJust the last one.
Comment #9
IWasBornToWin commentedJust applied the patch, changed my widget to autocomplete deluxe the field using entity reference as got this error;
Fatal error: Call to undefined function entityreference_get_handler() in /sites/all/modules/acdx_references/acdx_entityreference/acdx_entityreference.module on line 97
I will look and see if I can find the problem.
Comment #10
john morahan commentedHmm apparently the function was renamed to entityreference_get_selection_handler and now requires an $instance parameter too.
Comment #11
IWasBornToWin commentedI appreciate your fast replies. Based on your last comment is there something I need to do on my end?
For what it's worth, the main module of automcomplete deluxe isn't currently dropping down on my site with any fields. I installed it a long time ago and it worked. I just re-installed it today.
I'm trying to locate what changed in my site which would stop it from dropping down or looking for any of my data when I start typing. Not sure if that has anything to do with my error or not.
Comment #12
IWasBornToWin commentedI got this message when trying to save a taxonomy term in a term reference field using regular autocomplete deluxe module. Wonder what it would even have to do with this module?
Fatal error: Cannot access empty property in /sites/all/modules/acdx_references/acdx_entityreference/acdx_entityreference.module on line 191
Comment #13
john morahan commentedComment #14
IWasBornToWin commentedworks great...thank you!
Comment #15
IWasBornToWin commentedWhen I try to add more values than allowed I get a message--field_cardinality.
Is this from this module? The average user probably has no idea that it's a message claiming they're trying to add too many values.
Comment #16
IWasBornToWin commentedThe drop down button does nothing unless the field has focus and you type at least one letter. This triggers the dropdown list and then the button will work, no other time.
Comment #17
john morahan commentedThe field_cardinality error is due to the widget not implementing hook_field_widget_error().
The drop down doing nothing is, IIRC, because entityreference itself does not give us any information unless we pass something in. The original issue proposes solving this by patching ER in #1295032: Compatability with Autocomplete Deluxe for References. I don't think this is the right solution, but I don't have a better one right now.
Comment #18
IWasBornToWin commentedI've applied your latest patch. I may be wrong but it seems this is now more like a filter, not a drop down. At this point, the button could be hidden. The only way you can get the drop down to work is, as we discussed above, by clicking on and typing at least one letter. When you type "a" the only thing in the list are terms with "a". You can't scroll the entire list (since it's only scrollable when you type in a letter). I do not remember this being the case before all the patches? Although, it could just be my memory.
Comment #19
john morahan commentedTry this.
Comment #20
john morahan commentedOr alternatively without the 10-item limit... (of course you would need to be careful to avoid using this with a large vocabulary)
Comment #21
JohnnyX commentedI'll do some tests with patch #19. I hope it works for me with og 7.2...
Comment #22
JohnnyX commentedPatch #19 works for me so far. If all works fine it could/ should be commited...
Comment #23
JohnnyX commentedSeems to work fine!
Comment #24
daniorama commentedThe description of this module should be changed as well as include a link to this module in entity_reference and autocomplete_deluxe modules' sites as soon as the patch is finally applied to the code.
Comment #25
pichot commentedThe autocomplete functionality is working well. But I'm encountering this error if I add too many tags:
field_activity_alumni cannot be longer than 128 characters but is currently 175 characters long.
I dpm and that form item is set to #maxlength (Integer) 1024
The field is an Entity Reference to a Profile2 profile entity using the Autocomplete Deluxe (tags) widget.
Thoughts?
Comment #26
pichot commentedForget it. I found the relevant issue in Autocomplete Deluxe. Appears to be fixed in dev.
http://drupal.org/node/1263928
Comment #27
JohnnyX commentedCould be commited?
Comment #28
Matthew Davidson commentedOoh, like very much. Should stop people (like me) using taxonomy terms instead of a more appropriate entity type just for the cool widgets.
In my testing, the wrapper div around each item returned by the autocomplete callback was rendered as HTML-escaped text. I expect something's changed somewhere down the stack recently. Here's a variant on #19 without the wrapper div.
+1 to committing.
Comment #29
Fidelix commentedWhen saving the field settings:
Notice: Undefined index: create_bundle in acdx_entityreference_field_widget_settings_form() (line 85 de /mysite/sites/all/modules/contrib/acdx_references/b/acdx_entityreference/acdx_entityreference.module).Comment #30
mojiro commentedHave you noticed something similar ?
Submitted data are being cropped left & right by two chars...
I checked the browser post data, and are correct.
It's probably a problem of my installation but I do not know where to check for the moment.
Comment #31
mojiro commentedI found this patch for autocomplete_deluxe http://drupal.org/node/1754164#comment-6434506
Comment #32
mojiro commentedAt line:
it is being specified the number of results. Couldn't be better, the number of results to be retrieved from the view that is being used to bring the results?
Comment #33
marblegravy commentedI found the patches at #19 or #28 to both be fine with the current release version of Autocomplete Deluxe, but they both break any autocomplete widgets on the page when used in conjunction with the current dev branch of Autocomplete Deluxe (I was using 7.x-2.0-beta2+9-dev)
I suspect it has to do with the autogrow stuff that was added here -> http://drupalcode.org/project/autocomplete_deluxe.git/commit/90d95d3 but not knowing enough about how this works, I don't think I can help any more than that other than to include a screenshot of what was going wrong:
https://docs.google.com/open?id=0BzEg1h_E2DyzX1d3Ukk0YU9FZ3c
What I just noticed on the Autocomplete Deluxe commit notes however was this:
As I need to deny terms for taxonomy fields using (preferably) the same widget, I gave Chosen a go and it appears to be working great with Entity Reference.
Comment #34
Matthew Davidson commentedmojiro: I would have thought so too, but a quick look at the code suggests that's how entityreference_autocomplete_callback() in entityreference.module works too. Not 100% sure. Either way, I think it's something to raise as a separate issue after this has been committed.
Comment #35
Matthew Davidson commentedHere's a new patch updated for current dev versions of entityreference and autocomplete_deluxe. It fixes the PHP notice at #29 above, as well as a critical issue I had with creating nodes titled "" (that's two double-quotes) and worse, due to picking the wrong submitted value during _acdx_entityreference_autocomplete_tags_validate(). I'm not sure about the possible autogrow issue in #33; I'm getting larger fields with all autocomplete_deluxe widgets, not just our ones, so maybe it's their issue. I'll look into it later, but I just wanted to get this posted for people to test.
This also I think makes #1823260: Release new beta3-version, due to data-corruption in #1754164 a blocker for putting this into a stable release but I'd like to see it committed ASAP if it passes muster, and will happily put my hand up to become a co-maintainer if that will help make it happen. I use entity references all over the place, and do not feel comfortable deploying patched modules on live sites.
Comment #36
Matthew Davidson commentedOkay, whose idea was it to chase a moving target? Oh. Mine.
Updated to cope with recent changes to entityreference (#1821060: Return values from getReferencableEntities() keyed by bundle).
Comment #37
johnv@Matthew, how about releasing this as a separate module? Ofcourse, after consulting sepgil.
Comment #38
HydroBlast commented36 patch works.
acdx_entityreference.module
Based on it was a new patch.
There were no set minimum length.
Comment #39
Matthew Davidson commentedHere's a new patch that incorporates HydroBlast's autocomplete minimum length and also some changes to make autocreation of new entities work when the entityreference field is attached to an entity that has it's create/edit form embedded in another entity's form, eg. field collections.
John Morahan had a really cunning mechanism for creating new entities in a hook_field_attach_presave() implementation, after the form has been fully validated. This is the Right Way to do it, but doesn't work in the above case. I spent several days tearing my hair out, trying to do something similarly cunning, but couldn't find a way to make it work, so I ended up just doing the entity creation during element validation, which is a bit Wrong, but works in all cases I can come up with. Suggestions for better approaches welcome.
As for the suggestion to make acdx_entityreference a separate project, that makes a lot of sense, except insofar as I'm a really lazy module maintainer. However if sepgil or one of the above contributors want to be co-maintainers I'm happy to kick it off.
Comment #40
rerooting commentedJust tested out #39, seems to work ok, however for whatever reason, deleting a reference is not working. Upon deleting a reference and saving the node, when I go back to edit it, the reference is still there.
It should be noted I'm using this with OG 2.x. I will try this again with a normal entityreference field and see if this isn't being caused by the OG behavior somehow.
Comment #41
super_romeo commentedThanks for patch!
But it not respect RealName module, then select user entity reference...
Comment #42
henrijs.seso commented@Matthew Davidson, @HydroBlast
You don't have permission to access /MYSITE/acdx_entityreference/autocomplete/field_geographic_indication/node/recipe/ /10 on this server.. Notice space in URL.@super_romeo Please open new issue about this.
Comment #43
bennos commentedtested patch
https://drupal.org/node/1295034#comment-7104800
it works on a vanilla install. A lot us thing needs to be adjusted (Example:when via entityreference a user is searched), but this get's on the todo list when we have a starting point.
Made a crosspost in autocomplete deluxe module. there was a feature request for support of entityreference.
Comment #44
brentratliff commentedI'm able to install both 36 and 39 but there is no autocomplete. Just a select list arrow and the 'This term " will be added' dialog. I'm trying it on a field collection field...... Disregard - needed updated EntityReference.
Comment #45
brentratliff commentedI have this working but I don't see any difference from core autocomplete with the exception of using jQuery to do the heavy lifting. Am I missing something? I've tried single and multiple values.
Comment #45.0
brentratliff commentedadded link to other patch
Comment #46
zilla commentedwhatever happened to this? it would still be great to see this come to life, particularly because chosen does not work with mobile interfaces (defaults to a mega-scrolling-list with entity reference)
Comment #47
sinasalek commentedI applied the patch against the latest devsnapshot and upgraded autocomplete deluxe to it latest devsnapshot and now it works well.
Note that to support free tagging, a new field in field settings "Create new entities" should be set
Another tip is that use should have create permissions for the entity, otherwise new entities will not be created.
However it's not a proper way because for taxonomies for example that have only administer permissions users should have full admin access to taxonomies to be able to create terms via autocomplete field which is not practical.
It don't think that this module should do any access check when creating new entities , if use has access to a field with free tagging, it means that he can create new entities via that field.
Also for creating part entityreference_autocreate module can also be used
Comment #48
sinasalek commentedThe module creates empty terms, here is the patch to fix it
Comment #49
nithinkolekar commentedIs this patch only for terms or any entity like users, nodes, profiles etc?
Comment #50
sinasalek commentedAs far as i can tell, it's generic
Comment #51
nithinkolekar commentedtested the patch with acdx dev for nodes using entity reference. For hiding nid and also to show remove(x) button in autocomplete element widget should be set to Autocomplete Deluxe (tags). One drawback with this setup it will show "The term xxx will be added" although entity is not of type taxonomy and also creating new entities is disabled.
Comment #52
nithinkolekar commentedstill need to be cleaned when view is set as source for entityreference. It showing span elements like
<span class="views-field views-field-title"> <span class="field-content">node title 1</span> </span>temporary workaround is to disable
"Provide default field wrapper elements" in inline field settings.
"Add default classes" in field's style settings.
update:
node id is visible in parentheses when entity is in editing mode.
Comment #53
digitgopher commented#39 works for me. Here is a patch that adds to that the option to configure the 'The term xxx will be added' text, for when that text doesn't make sense.
Issues:
Needs a more thorough review!
Would be great to see this finally happen!
Comment #54
manu manuHi there, thanks for working on this.
When testing #53, adding new references will crash if "Create new entities" setting is set to "Don't create".
Focal Point is triggering the error, but every module implementing
hook_field_attach_presave()would do so when extracting ids.The problem is that
_acdx_entityreference_autocomplete_tags_validate()is not checking$field_instance['widget']['settings']['create_bundle']and is creating an entity with no bundle.Aside of this, if no entities can be created,
_acdx_entityreference_autocomplete_tags_validate()should set a form error when no matching entities are found.Will post a patch as soon as I can.
Comment #55
edodusi commentedHi, I tried #53 and it's working good, now we're gonna use it in a production website.
I think this should really be a stand-alone project, there's no need to keep it bundled with acdx_references.
Also, I did not get the issue reported in #54 setting "Create new entities" to "Don't create".
+1 for me
Comment #56
millionleaves commented#53 worked for me too. Not allowing the creation of new entities so #54 not applicable in my case.
Thanks.
Comment #57
dajka commented#53 works perfectly! Thanks a lot for this. Also didn't get the issue in #54.
+1 for stand-alone project
Comment #58
odrzutowiec commented#53 works for me thanks!
Comment #59
sinasalek commentedComment #60
seren10pity13 commented#53 works well, thanks !
Just had a problem with single quote appearing like this :
'I solved it with htmlspecialchars_decode :