PDA

View Full Version : " and " --> not going into option boxes corrrectly..please advise


BrightNail
02-25-2004, 10:31 PM
Hello,

I am getting data from the "app layer" and its returning thru a plugin that converts certain characters as their HTML equivalents....such as:

' is coming thru as "

now, I am doing pattern matching on some dropdowns...

so for example, a dropdown value would be:

This " IS " a cool game

but it shows thru the page as:
This "IS" is a cool game

the problem is, in the javascript arrays I have..I have the encoded versions...but the "text" values for the dropdowns are - This "IS" is a cool game --> so they don't match...PLUS, when I can get the array value to show, it shows in the dropdown as:

This " IS " a cool game

its not HTML-atized as it is onload....weird??????

glenngv
02-26-2004, 06:26 AM
The html entities you typed must have been rendered by the browser but I saw your point. Can you post some codes? To properly type entities in your post, you must make the & symbol as entity also. i.e. " will display "

BrightNail
02-26-2004, 10:00 PM
okay...

here is what the select box looks like onLoad..
keep in mind, that the initial display DOES LOOK correct even the the option.text value has html characters sets....ala..


<select NAME="quotes" onChange="storenameVal(this.options[this.selectedIndex].text);"> <OPTION VALUE="">Quote 1</OPTION>
<OPTION VALUE="">I &quot;SEE&quot; &amp; hear you </OPTION>
</select>


in the array it shows..

var quotes = new Array("I &quot;SEE&quot; &amp; hear you")


but when I try to match them when a user selects that option...it doesn't match...
I take the option TEXT value --> but that is this: I "SEE" & hear you

even though in the code it looks like what is shown above...so the option TEXT is trying to match..

I "SEE" & hear you
to
I &quot;SEE&quot; &amp; hear you

and it doesn't work.

SO - how do I translate it out before the match? Is there something like the "encode" method in js for this?

I keep trying to edit this...but my HTML character set for quotes and ampersands are showing up 'normal'.....so?

glenngv
02-27-2004, 01:22 AM
As I said in my previous post, you must encode the ampersand symbol to correctly display html entities.

To correctly display &amp;amp; type &amp;amp;amp;
and to display &amp;quot; type &amp;amp;quot;

Try editing your post again.