Select to view content in your preferred language

pop-up hyperlinks not working: spaces getting translated to %2520

4406
8
04-24-2013 01:47 PM
by Anonymous User
Not applicable
Hello,

I am configuring a pop-up in FlexViewer 3.1 using HTML.  One of the items in the pop references a field in my map service that contains a fully qualified url.  The urls all use %20 instead of spaces.

Previously in my v2.4 of this same web application, the pop-ups work fine.  They are configured in the <configuration> tag:

<field name="PLANURL" alias="Plan Link:" visible="true"/>

With version 3.1 however, I though I'd use HTML within the <description> tag to style the hyperlink so that to the user it looks something like this:  Plan: Smith River Conservation Plan (Link)

<description><![CDATA[< <br><i><b>Plan:</b></i> {PLANNAME} <a href="{PLANURL}"> (Link) </a> ]]></description>

Problem:  when I click on the Link in the pop-up, I can't get to the url because all instances of %20 (which represent spaces) have been changed to %2520.

I don't understand why the %2520 - I can't figure out if this is a problem with my href syntax, or if it's an Adobe thing ...

Any help is appreciated - thanks.
Tags (2)
0 Kudos
8 Replies
AnthonyGiles
Honored Contributor
Katie,

That is a strange one, one point which maybe be unrelated or just a typo on your post but you seem to have an extra opening tag in your CDATA:



<description><![CDATA[< <br><i><b>Plan:</b></i> {PLANNAME} <a href="{PLANURL}"> (Link) </a> ]]></description>



Should this not be:

<description><![CDATA[<br><i><b>Plan:</b></i> {PLANNAME} <a href="{PLANURL}"> (Link) </a> ]]></description>

Regards

Anthony
0 Kudos
by Anonymous User
Not applicable
you seem to have an extra opening tag in your CDATA:


Whoops; I selected just the line item in question for my post, and missed that typo.

I don't think it's relevant but URL is pointing to Salesforce ...

As I said, it worked fine when in version 2.4, but using the href in 3.1 causes the weird %2520, so I have to believe that is where the problem lies.

I tried looking here, but I'm a HTML novice that I can't figure out where it's hidden.
0 Kudos
RhettZufelt
MVP Notable Contributor
Well, the browser will interpret spaces in the url as %20.  also, will interpret % sign as %25, so what is happening is that it is substituting the %25 for the %, then putting the 20 on the end.

Not sure all the ways to deal with this in the flex app.  You could use the popuprendererskin to replace all %20's in that field with a space.

Easiest way, since you said it is your service, would be to do a global find/replace on that field in ArcMap and replace all %20's with a space.

R_

If you do have the source code, and want to go the popuprenderskin route, this is what you need.

Inside the commit properties function there is a
 for each (var fieldInfo:PopUpFieldInfo in popUpInfo.popUpFieldInfos)
loop.
Add this inside that loop,
if (formattedAttributes[fieldInfo.fieldName] == "PLANURL"){
     formattedAttributes["PLANURL"] = ((formattedAttributes["PLANURL"]).replace("%20"," "));


This will replace ALL %20's (in that field) with a space.
0 Kudos
by Anonymous User
Not applicable
so what is happening is that it is substituting the %25 for the %


So, is Flex the "it"?

I will opt for doing a find/replace in my attribute table.

I appreciate you responding, thanks.
0 Kudos
RhettZufelt
MVP Notable Contributor
Well,   the browser will interpret spaces in the url as %20. also, will interpret % sign as %25, so what is happening is that it is substituting the %25 for the %, then putting the 20 on the end. 



"It", is the browser. type any address in the browser that has a space in the pathname and hit enter, you will magically see the %20 appear.

R_
0 Kudos
by Anonymous User
Not applicable
Right. 

What I don't understand is #3 in this list:

1) if I copy a URL complete with the %20s, from Notepad e.g. and paste into any browser, the browser correctly interprets the %20.

2) when I used those URLs in FlexViewer 2.x (with %20s) the links in my pop-ups were fine.

3) only in v3.x when I styled the pop-up with html, did the %2520s appear ... that's why I asked what is the "it" because I don't see how what I'm doing now (styling via html) is different from my browser's perspective.

I have already removed the %20s and my links are working -- my ongoing questions are more of a curiosity.

Thanks.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Katie,

   To answer your question then, because you are using the description tag what happen under the hood is that all the text goes in a Spark TextArea and uses a TextConverter.TEXT_FIELD_HTML_FORMAT which converts all the text and links to html format i.e encoding spaces with %20 and % as %25. Bottom line is that the PopUp is not expecting any of the text to already be html encoded and thus re-encodes the text.
0 Kudos
by Anonymous User
Not applicable
Thank you for that explanation!
0 Kudos