Views replacing & with & in the created urls

Ology - March 6, 2009 - 20:46

I am sure this is simple and I have searched around and not found anything yet.

I used the CCK to create a node and one of the fields is a url and another is the string to appear for that link. In the Views module I add both, excluding the url from the view and then for the text I say make this into a link and use the other filed as the url.

Now those urls have & in the url and in my database, but when the Page is created the urls now say & amp; and don't work.

How do I fix it so that the links created use the text as it is in field?

Thanks

CCK Display Fields

gbrussel - March 6, 2009 - 22:27

My gut reaction is that your Display Fields option for that field is not set to "Plain Text" which could cause some issues with stripping out or altering things like the ampersand. What's it set to for the full node view?

I appreciate the help and

Ology - March 7, 2009 - 22:35

I appreciate the help and that sounds like it would be it and I went in and changed it to make sure its "Plain Text" and I still have the same issue.

For the field in question I have the following settings in that View:
Output this field as a link checked, and then in the link path I have [field_url_value] which has the url value in it with simple & in the text.

I then have the label set to Widget label (link String)
and Format is "Plain Text"

The settings for the [field_url_value] are:
Exclude from display
Widget Label (link)
Format = "Plain Text"

I am not sure if helps but when I do a normal search of the site and look at the node the string that is used as [field_url_value] is correct and does not have the & instead it is simply &.

To try a test I then changed the [field_url_value] to not be excluded so I could see the text. The first result was an error "Validation error, please try again. If this error persists, please contact the site administrator." I then retryed the change and it worked.

So I end up with a table that has the url string showing without the amp; and then right next to it the link with the amp; in it.

Same Issue Here

tbannister - March 17, 2009 - 20:28

I seem to be experiencing the same or a similar issue. I have a taxonomy field that I'm outputting as a link. A couple of my terms have ampersands in them and now they don't work. I'm reasonably sure that they worked in 6.9 and they stopped working when we upgraded to 6.10. Whether it's a bug in 6.10 or just a coincidence I'm not sure, but it looks like the link is getting encoded twice.

subscribe - I have the same

eileenmcnaughton - March 23, 2009 - 06:13

subscribe - I have the same symptoms

same problem, an issue for me

robertdjung - June 1, 2009 - 20:54

same problem, an issue for me using feedapi / feed element mapper as many URLs have & in them. subscribe.

Quick Fix

thompcha - April 19, 2009 - 18:01

Hey, I don't know how advisable a fix this is, but I was able to put a bandaid on the problem by using a regular expression to replace HTML-escaped ampersands with regular ampersands in the return value of render_as_link() in views_handler_fields.inc:

    return preg_replace('/&/','&',$value);

For me this is on line 493 of views_handler_fields.inc

I'm running Drupal 6.10 with the following:
Views 6.x-2.5
CCK 6.x-2.2

Subscribe - having the same

kat3_drx - September 23, 2009 - 13:05

Subscribe - having the same issue

same here

carlogen - October 22, 2009 - 15:25

same here

 
 

Drupal is a registered trademark of Dries Buytaert.