I have a view pane to which I pass a taxonomy term through the contextual filter "Taxonomy term: Parent term". I have configured the 'Taxonomy term' Validator with the appropriate vocabulary and Filter value type "Term name". My problem is that the view fails to validate if I pass it a term name with dashes in it. THis despite having checked the
"Transform dashes in URL to spaces in term name filter values" box under Filter value type.
The view validates fine if I pass it a term with no dashes in it.

emk

CommentFileSizeAuthor
#4 view.txt5.6 KBRoad Kill

Comments

svouthi’s picture

Issue summary: View changes

I am having the reverse issue with Views 7.x-3.8 when using Taxonomy term: Name as a contextual filter. This works fine for me except when a term has a space in it. This despite having checked the validator specified as you have and the "Transform dashes in URL to spaces in term name filter values" box checked.

I am appending taxonomy term field values (via the Taxonomy term: Parent term relationship) to the URL to trigger the contextual filter above, and have checked "Convert spaces in term names to hyphens" in its settings as well. The hyphens/dashes are there, but they aren't being translated properly to my terms with spaces.

svouthi’s picture

An update - a more experienced acquaintance of mine tested this with Views 7.x-3.8 also and had the same result using Taxonomy: Term ID with the validation criteria specified as Taxonomy Term, the taxonomy vocabulary, Filter Value Type: Term name converted to Term ID, and "Convert spaces in term names to hyphens" checked.

I should mention that neither of us are using view panes.

svouthi’s picture

Version: 7.x-3.7 » 7.x-3.8
Road Kill’s picture

Title: Transform dashes to spaces does not work » Transform dashes to spaces does not work still a problem
Version: 7.x-3.8 » 7.x-3.14
StatusFileSize
new5.6 KB

First just a big thank you to all the people involved in the Views module you make a lot of what I do in Drupal possible. I have created a content type called brochure for uploading a brochure in pdf format which can then be downloaded from the website.
In the view I have two fields one is and icon field and the other is a file field. The file field formatter is set to URL to file and has been placed above the icon field with the file field excluded from display enabled.
In the icon field I have used a file field replacement pattern in the link path with replace spaces with dashes and transform the case set as lower case.
The replace spaces with dashes is not working. When I hover over the icon the URL structure is perfect except that the spaces have no dash which creates a 404 error when the icon is clicked.
I have done this hundreds of time but now for some reason replace spaces with dashes is not working.
My pdf structure looks something like this Test brochure 2016.pdf

I have attached my view should you need to see the structure.

calefilm’s picture

I figured out a solution to my problem (same as #2):

In view, add relationship: Content: Taxonomy terms on node
In contextual filters, select: Taxonomy term: Term ID

edit contextual filter: Taxonomy term: Term ID

Specify validation criteria: Taxonomy term
select vocabulary
filter value type: term name converted to Term ID
select: Transform dashes in URL to spaces in term name filter values

lastly, i needed to provide a default value to accompany my term's placement in the url

summit’s picture

Version: 7.x-3.14 » 7.x-3.23
Priority: Major » Normal

Hi, using latest D7 views and latest drupal version.
I am exactly doing what is said on latest on this thread. I made the contextual filter as such.

Terms like A6 are correctly recognised, terms like A75 - Clermont-Ferrand - Béziers are not recognized.
What can I do to let the view recognize A75 - Clermont-Ferrand - Béziers. It has dashes, spaces and special character...

Thanks a lot for your reply

brankoc’s picture

I have been able to reproduce this, but (so far) only if there were two near identical term names, where the difference was that one had a hyphen where another did not.

Let us say you have two nodes, one called Foo and the other called Bar. Foo has an associated term called 'a 1' and Bar has an associated term called 'a-1', then the view as described in #5 will only return the node associated with the term that was defined first.

I believe this may be because the validation code that expects a term name, only expects one term name, whereas the actual database statement may fit multiple term names.

In the example given above, the database statement SELECT * FROM `taxonomy_term_data` WHERE replace(name, ' ', '-') = 'a-1' will return two rows, one containing the term 'a 1' and the other containing the term 'a-1'.

The code in views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc does not appear to iterate through the result, but appears to only look at the first result.

I just realised that what I am describing here is probably not the problem that the issue reporter had (especially since #5 describes his view as a solution).