The select or other widget is a pretty popular interface for adding new terms to a list. It should be available as a widget for Term Reference fields.

Original report by populist:

I really like this module + the approach it takes and was wondering what kind of development work/direction would be required to get this working with the standard term reference fields. It has always bothered me that either you assume a fixed/hierarchical structure or also free tagging, but that you can't get something in the middle.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

danielb’s picture

I am unable to advise you about this as I'd pretty much have to figure it out and write it to be able to explain it. Surely it's simply a matter of populating the options with existing terms and then looking at the form submissions to see what incoming data looks like and then handling that appropriately.
I am unsure if you will be able to add to a term reference field, or if you have to make your own version of that field to be able to get it past validation and handle the submission, etc...

Robin Millette’s picture

populist, sounds like a job for autocomplete deluxe.

danielb’s picture

Status: Active » Fixed

there ya go

Robin Millette’s picture

Fixed, as in won't fix? Or did I miss a commit?

spouilly’s picture

Why not mention select_or_other_taxonomy ?
see http://drupal.org/node/1208512#comment-5605324

I thought I posted a message about it previously, but can find it anymore ...

S.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

kaizerking’s picture

Status: Closed (fixed) » Active

probably if some one one could bring that taxonomy other in to this it would be nice

dtrees’s picture

Is this module needed to get a select other field for taxonomy terms?

I am currently testing an approach where I am using two fields for a content type that reference the same vocabulary. For example, the Category field is set a term reference field with a radio button/check boxes widget and the second field is labeled Other set as a term reference to the same vocabulary and has the autocomplete widget. The problem with this approach is that when a user enters a value in the autocomplete field and saves the node Drupal only saves a new term to the vocabulary. It doesn't actually select that term.

I set a rule as a workaround, if (condition) category other field is NOT empty then (action) add the data value to category list and set the Other field value to blank. Hopefully I can clean up the CSS to show it properly.

Can someone please tell me what I am missing, is this a bad data approach?

haydeniv’s picture

Title: Support for Taxonomy Terms » Incorporate Select or Other Taxonomy module
Category: support » feature

Why not mention select_or_other_taxonomy ?
see http://drupal.org/node/1208512#comment-5605324

Looks interesting. I'll take a look at whether it is a good fit to incorporate into this module.

@dtrees I don't see that kind of integration happening anytime soon with this module so your work around is probably the best bet.

haydeniv’s picture

acbramley’s picture

+1 for getting select or other taxonomy in, I've just tested installing both modules and creating a taxonomy reference field and it worked without errors, just what I needed.

haydeniv’s picture

I've posted for input over at #1208512: Port Taxonomy Other to D7 to see what those guys think about this.

haydeniv’s picture

One thing that we will want to consider in all of this as well is that Entity Reference is now in core in Drupal 8 and is looking to deprecate the term reference widget. #1847596: Remove Taxonomy term reference field in favor of Entity reference

If that lands that will change the behavior of this module, and make a lot of work for the upgrade path, if we choose to incorporate taxonomy.

acbramley’s picture

Can we not just get the 7 port of Taxonomy Other committed as a release for that module and leave the 2 separate?

voipfc’s picture

Concerns about Drupal 8 are rather premature now. The problems with Drupal 6 contrib modules languishing when Drupal 7 hadn't taken off yet are going to be repeated here if module developers adopt this outlook. The only thing they will have in common is the name, and the promise that Drupal 8 will be considered ready when Drupal 7 can be imported into it. Evolutionary development matters and Drupal 8 is a radical change.
Consider that even Drupal.org is still on Drupal 6.

haydeniv’s picture

Assigned: Unassigned » haydeniv
Status: Active » Needs work
FileSize
7.36 KB

Let's do this then.
I'm marking #1208512: Port Taxonomy Other to D7 as a duplicate of this issue and we'll track the port here. Here is an initial patch against 7.x-3.x. Right now it is just a separate module but we need to decide if we want to just add it as a formatter whenever Select or Other is enabled.

John Pitcairn’s picture

You didn't actually close the other issue...

Considering a term is already an entity, then another possible approach is using an entityreference field rather than term reference, then entity connect will allow users to create and add new terms to an existing select/checkbox/radio list directly within the parent edit form.

rvilar’s picture

Patch in #16 works for me. Maybe can be better to add this submodule in a new folder to keep the original module organized.

haydeniv’s picture

Idealy this won't be a submodule but just a new formatter for all of the field types.

SchwebDesign’s picture

#16 works great for me as well... with a HUGE added bonus...

Using a taxonomy term reference field with Select (or other), instead of a normal text field with Select (or other) allows you to have a select list/drop down of allowed values if exposing this as a filter in a view.

See these two issues here:

https://drupal.org/node/1495650

https://drupal.org/node/1450870

I believe 'converting' your text field input to being taxonomy terms instead is the best solution for this. (one good way to do that is here: https://drupal.org/node/215472#comment-2086422 )

haydeniv’s picture

Just so that this is perfectly clear: this issue is set to "Needs Work" because the patch is no where close to a state where it will be committed. I plan on integrating the functionality into the main module and not keep it as a separate module. That means it is not a good idea to use this patch on a live site yet. It is going to change drastically by the time it actually gets committed and there is no guarantee that won't break your site if you try and install the actual module after running this patch. I just posted the patch as a starting point if others wanted to help out. If you already know that great! If not, be warned. :)

SchwebDesign’s picture

Thanks! Indeed, that's a good warning and i was largely expecting it (rather than running patch, i manually added this submodule and am keeping track of that modded code (apart from the original module code). I'll be watching here for updates on when ends up happening with this. Thanks!

galaxor’s picture

Hi. I was on a plane without access to the internet, so I didn't see that work had already been done on this. Therefore, I also did an integration for taxonomy term reference. I haven't looked at your patch, so I don't know if mine has any advantages over yours, but mine seems to work for single- and multiple-select, and for checkboxes and select lists.

Here is a patch based on the 7.x-2.x branch.

aze2010’s picture

subscribing! Important

moonray’s picture

Status: Needs work » Reviewed & tested by the community

Patch in #23 worked like a charm.

ShaunDychko’s picture

Status: Reviewed & tested by the community » Needs review

Setting to "needs review" to get @haydeniv's feedback on the patch in #23.

ShaunDychko’s picture

Version: 7.x-2.x-dev » 7.x-2.19
FileSize
12.27 KB

Rerolled patch #23 against 7.x-2.19.

flocondetoile’s picture

Hello,

Patch #27 works fine with 7.x-2.19

haydeniv’s picture

Version: 7.x-2.19 » 7.x-3.x-dev
Status: Needs review » Needs work

This will be a 3.x feature. Please reroll. Also everything new in 3.x will need tests. Thanks!

haydeniv’s picture

Issue tags: +Needs tests

Tagging

ChiKam’s picture

So far, the patch in #16 is working for me. Thanks!

rvilar’s picture

This is the same patch from #27 but with support for translation of taxonomy terms.

rvilar’s picture

Issue summary: View changes

Update issue summary for new feature request.

jsibley’s picture

Is this stalled? Any chance of a status update?

Thanks.

haydeniv’s picture

This is scheduled for a 3.x release which is a little stalled right now. In order to get a 3.x release out this module will need automated testing added, all javascript converted to Drupal AJAX framework and an upgrade path from 2.x and Taxonomy Other for Drupal 6. Patches are always welcome.

gbyte’s picture

#32 and the previous patches works well except the setting 'Ignore the values' doesn't work. The value in 'Other' gets always added to the taxonomy vocabulary no matter what. Or is this expected behavior?

bpadaria’s picture

Issue summary: View changes

A correction I noticed for terms with comma, on patch mentioned in #32.

In select_or_other_field_widget_validate() function,

$element['#value'] = implode(', ', $terms); should be replaced with
$element['#value'] = drupal_implode_tags($terms);

It takes care of terms containing comma.

Hope it helps

DamienMcKenna’s picture

This is the patch from #32 with the fix recommended from #36 included.

DamienMcKenna’s picture

BTW from a basic functionality perspective, this appears to work nicely, and is a great alternative to the usual tags UI.

DamienMcKenna’s picture

FileSize
12.37 KB

Updated to resolves a few small coding standards bugs.

tyler.frankenstein’s picture

Status: Needs review » Reviewed & tested by the community

#39 works great. Tested the "Select (or other) list" and "Select (or other) check boxes/radio buttons" widgets against single value, and multi value fields.

haydeniv’s picture

Status: Reviewed & tested by the community » Fixed

I would have liked to see some kind of test added for this but as we don't have tests for any other parts of this module we may as well get it in.

  • DamienMcKenna authored 138c400 on 7.x-3.x
    Issue #1716764 by DamienMcKenna, rvilar, ShaunDychko, galaxor, haydeniv...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

abu-zakham’s picture

Geart works @DamienMcKenna works with me

PhilY’s picture

#39 works great with select or other 2.20, thank you DamienMcKenna.
Edit: and 2.21 as well ;-)

kopeboy’s picture

Could you please mention it supports taxonomy fields on the module page with version 3?

I found this unintentionally after weeks I tried the module (with the stable release of course) which was missing the functionality.. :/

legolasbo’s picture

@kopeboy

I've just added the following to the module page.

taxonomy integration has been added in 7.x-3.x.

kopeboy’s picture

Thanks by Drupal users for the quick answer and solution! :)

kopeboy’s picture

Will this work with multilingual taxonomy? I mean Entity translated term titles..

legolasbo’s picture

@kopeboy, I don't know, only one way to find out ;)

abu-zakham’s picture

@kopeboy see this issue https://www.drupal.org/node/2400005

brandonc503’s picture

Hi. I am trying to find out if there is existing issue open already for when term is child in hierarcy..

http://oi60.tinypic.com/aeutmo.jpg
(that image is just entering edit node. the other is checked already and has Hats entered.)

here my node has Clothing and Hats term.. but since Hats is under Clothing it comes up -Hats.. which is not seen the same as Hats. If i was to now check -Hats, -Hats is added to vocab, so I then have -Hats and Hats

If i remove Hats from under parent then refresh node edit page.. http://oi57.tinypic.com/13zq05v.jpg

Using the 7.3 dev btw. THANKS

legolasbo’s picture

@brandonc503,

The issue you are describing is a new one. Please open a new ticket for it, so it can be addressed appropriately.

Also the first image you linked does not work and hotlinking images is not recommended. You can upload images to your issue/comment.