2012-07-31 16:08:37

colak
Admin
omega
Real name: Yiannis
From: Cyprus
Known languages: el, en
Website

[SOLVED] ampersands in urls and validation

I would like to link to a particular url with an ampersand in it. The url is

http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=13140

As we know the above causes xhtml to fail. I have tried

http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=13140,
http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=13140
and
http://mitpress.mit.edu/catalog/item/default.asp?ttype=2\x26tid=13140

but the page returns the following error

Microsoft VBScript runtime error ‘800a000d’
Type mismatch: ‘aEditionDetails’
/catalog/item/default.asp, line 1452

Can anyone suggest a valid xhtml alternative?

Offline

 

2012-07-31 16:19:29

Gocom
Developer
omega
Real name: Jukka Svahn
Website

Re: [SOLVED] ampersands in urls and validation

There you go:

Illusions in Motion

Code:

<a href="http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&amp;tid=13140">
	Illusions in Motion
</a>

Or in Textile:

"Illusions in Motion":http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=13140

Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />

Offline

 

2012-07-31 16:28:01

colak
Admin
omega
Real name: Yiannis
From: Cyprus
Known languages: el, en
Website

Re: [SOLVED] ampersands in urls and validation

Hi Jukka,

I am using custom_filelds, not textile and when I type http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&amp;tid=13140 it returns the error above. Try to go to it and you will see.

Offline

 

2012-07-31 16:31:37

colak
Admin
omega
Real name: Yiannis
From: Cyprus
Known languages: el, en
Website

Re: [SOLVED] ampersands in urls and validation

Looking at it again, it is strange. Using textile the ampersand is encoded the the link does go there (from this forum), but without the textile, ie using

<a href="http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&amp;tid=13140">
	Illusions in Motion
</a>

the link returns the error page.

Offline

 

2012-07-31 16:48:10

Gocom
Developer
omega
Real name: Jukka Svahn
Website

Re: [SOLVED] ampersands in urls and validation

colak wrote:

I am using custom_filelds, not textile and when I type http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&amp;tid=13140

Custom fields already do escaping for you. Please see escape attribute. The following generates valid HTML when the custom field contains http://example.com/?foo=1&bar=1:

<a href="<txp:custom_field name="publisher_link" />">
	<txp:custom_field name="publisher_link" />
</a>

If you need to use HTML within a custom_field itself, set the escaping off (escape="").

Last edited by Gocom (2012-07-31 16:49:58)


Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />

Offline

 

2012-07-31 17:24:04

colak
Admin
omega
Real name: Yiannis
From: Cyprus
Known languages: el, en
Website

Re: [SOLVED] ampersands in urls and validation

Gocom wrote:

Custom fields already do escaping for you.

Indeed they do and I did have the escape attribute but forgot about it so I was adding the amp; after the & which is what was messing up the url destination. Thanks Jukka. Problem solved.

Offline

 

Powered by FluxBB