Allows textfield to be rendered like a node reference, with some autocompletion magic on edits.

A university department wants to list the authors on their publications' page. Any given publication may have several authors, both from the department and outsiders, with their order being important (ie. it is quite likely to have an 'employee-outsider-employee-outsider' like order.) If an author is an employee of the department, his/her name should be displayed as a link to his/her own profile page, while outsiders' name should be displayed as clear text. There are several use cases with high probability here:

  1. It is quite likely to have an author order like 'employee-outsider-employee-outsider'.
  2. It is quite likely that a now-outsider author becomes an employee later on, in which case his/her name should automatically converted to a link to his/her profile without any changes to the publication.
  3. It is quite likely that the site editor wants to enter existing authors' names without typos, regardless of that they are employees or not.

So what does this module do then, anyway?

Let's switch to Drupal tongue. :) Want to have a nodereference-like link to a node that does not exist yet? Want to have autocompletion both on existing field values and on existing node titles of other content types? Install and enable this text_noderef.module, and all your problems fly away!

Let's follow the scenario described above.

  1. If you want to have a 'noderef-text-noderef-text' like ordering of multivalue field(s), you cannot have it done by simply using a simple textfield and a nodereference field, since they must be displayed in semi-random (ie. user-defined) order. Using only one of text or nodereference field is simply not an option.
  2. If a value of a textfield should be changed to a noderef (given that you have passed the previous point somehow), the node must be edited by hand--another point of possible failures and typos introduced.
  3. Using Autocomplete Widgets for CCK Text and Number is not an option either, since autocompleting on the existing field data is simply not enough.

How this module works

It simply adds a new widget and a new formatter for the text fields provided by the great text.module from the CCK project. The widget has autocompleting on both the existing field data and any existing node titles (you may want to filter this on specific content type(s), though, which is possible.) The formatter checks if a node exists with the title that is stored to the textfield, then it is displayed as a link to that node (if that textfield's widget is limited for any content type(s), then the target node must be one of the specified content type's, though).


You only need to install and enable the Text module that is shipped with CCK.

Ideas and future plans

You may ask the question if it is a good idea to check for existing node titles every time while rendering any value of a field, which may be a real burden on the underlying DB. Storing the field value as a nodereference if it is available at edit time was considered, but have been dropped for the reasons stated above. Anyway, it would be good if this could be switched somehow; ideas (or even better: patches) are more than welcome in the issue queue regarding to this topic.

Another way to improve this module would be to provide means to switch off any part of the autocompletion (on existing field values or existing node titles, but not both), and/or some Views integration like selecting a node view that should be used for autocompleting on node titles. Feel free to weigh in the issue queue (even better with a patch!) if interested in this functionality.


Paid support and module development is from KYbest.

Project information