I would like an autocomplete field which would be used to select a child node to attach. As relativity is now, it is not usable when there are thousands of possible children nodes, since a page must load with this entire list.

This should function in the same way as the the autocomplete field which is on the node edit page, used to change "Authored by:". For my purposes it is enough to have it search through the title field, though it may be best to design it to allow it to be configured to search node id, since title isn't necessarily unique.

An additional feature which would be beneficial, but is not necessary, would be to have multiple autocomplete fields, which would allow people to choose many nodes at the same time.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

a_c_m’s picture

Status: Active » Needs review
FileSize
6.21 KB
8.2 KB

Done!

Attached 2 patches, one for 2.3 and another for HEAD, let me know how you get on.

a_c_m

a_c_m’s picture

FileSize
41.86 KB

Here is an example of it working on some test data.

a_c_m’s picture

whoops, totally forgot to add filtering by the partly typed keyword, at the moment it will just return all values, oops - working on a new version now.

a_c_m’s picture

Status: Needs review » Needs work
a_c_m’s picture

Version: 5.x-2.3 » 5.x-2.x-dev
a_c_m’s picture

Status: Needs work » Needs review
FileSize
9.19 KB

Just the HEAD patch this time, if people want a 2.3 patch once this one is shown to work as expected, i might make one.

Also currently the auto complete will match against any part of the title e.g. auto complete "c" from the group [cat, dog, frog, coat, jacket, shoes] will match [cat, coat, jacket] not just [cat, coat] - do people think this is correct, or should it just match from the start?

a_c_m

a_c_m’s picture

FileSize
9.82 KB

Having a major problem with this patch. Cant get more than one auto-complete working on a single page. Problem is http://drupal.org/node/127156#comment-901691 any help is GREATLY apprecated.

Latest patch is attached, has print_r($form_values);return null; on line 1716 of the relativity_autocomplete_child_submit function, for debugging.

a_c_m’s picture

FileSize
10.51 KB

Hurray ! Working at last ! (how i got it working is here http://drupal.org/node/127156#comment-901731)

Please test and report back !

darius’s picture

Thanks, once I get a few confirmations that it works, I will commit the patch. One thing though: could you post a diff from the dev branch 5.x-2.x-dev, rather than HEAD. HEAD is quite outdated, and is not to be used.

Darius

a_c_m’s picture

Here is the patch.

kansaj’s picture

Hi
I have just tested the auto complete patch and have the following problem: it works fine when nodes are shown as teasers, but when I try to use it in full node view the auto complete does not work. Wondering what could be the problem. Tnx