Querystring issue Options
imayat12
Posted: Thursday, January 17, 2008 12:33:39 PM

Rank: Addict

Joined: 7/19/2006
Posts: 649
Location: Preston, UK
Guys,

I have a search form page built using xslt. Basically bunch of drop downs that write out some datatypes as drop down lists. I have search button which is processed by jquery to build a redirect url something like:

http://mysite/searchstockist?location=zyzzyz&productType=dgdfgdfg

The searchstockist page has xslt macro that gets the querystring params and does search

All works fine except for those parameter values that have & in them. So for example one location value is Central & West Midlands i am passing the parameter through the macro using [@location]. In the xslt due to the & i only get Central. Anyone any ideas how i can get round this.

Many thanks in advance.

Regards


Ismail

Level 2 certified. If it aint broke dont fix.
imayat12
Posted: Thursday, January 17, 2008 1:08:07 PM

Rank: Addict

Joined: 7/19/2006
Posts: 649
Location: Preston, UK
Duh,

(we could do with smiley that is getting hit over the head with a hammer) but for now this :blush: this will have todo. Fixed my issue added in my js file encodeURIComponent to encode the parameter and it all works.

Regards

Ismail

Level 2 certified. If it aint broke dont fix.
cpalm
Posted: Thursday, January 17, 2008 1:08:58 PM

Rank: Aficionado

Joined: 7/19/2006
Posts: 164
Querystring values should always be URLEncode, either by:

C# url.aspx?name=<%= HttpContext.Current.Server.UrlEncode("my & name"); %>
umbraco.library in xslt: url.aspx?name=<xsl:value-of select="umbraco.library.UrlEncode('my & name')" />
javascript: var url = "url.aspx?name=" + encodeURIComponent("my & name");

If would be best if you could use <form method="get"> since it ensures Querystring values will be URLEncoded

CPalm, www.cpalm.dk
cpalm
Posted: Thursday, January 17, 2008 1:09:27 PM

Rank: Aficionado

Joined: 7/19/2006
Posts: 164
Code:
C# url.aspx?name=<%= HttpContext.Current.Server.UrlEncode("my & name"); %>
umbraco.library in xslt: url.aspx?name=<xsl:value-of select="umbraco.library.UrlEncode('my & name')" />
javascript: var url = "url.aspx?name=" + encodeURIComponent("my & name");


CPalm, www.cpalm.dk
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.