Help required - Problem with illegal characters

S

skinnybloke

Hi - I am having problems witrh the code below (obviously) coming up
with illegal character for various characters within the field name
which is:

S_Gift Finder1_0


I have tried various ways of escaping the characters but to no avail.

I am unable to change the name of the field as it it comes from an
external off-the-shelf package.

See below for full javascript funtion.

Any help would be appreciated.

// define function to check that gift type and /or price range has
been chosen

function valgiftprice() {
if (document.forms) {
if (document.forms["giftfinder"].S_Gift Finder1_0.value == ""
&& document.forms["giftfinder"].PR.value == "-1") {
alert("Please choose a Gift Type or Price Range.");
document.forms["giftfinder"].S_Gift Finder1_0.focus();
return false;
}
return true;
}
}
 
V

VK

skinnybloke said:
Hi - I am having problems witrh the code below (obviously) coming up
with illegal character for various characters within the field name
which is:

S_Gift Finder1_0

JavaScript char sequences must be represented as u-escaped Unicode hex
pairs:
\uFFFF

So say _ would become \u005F : "S\u005FGift Finder\u005F0"
(see <http://www.unicode.org/charts/>)

But \u005F is simply underscore, and you don't have to escape it. It is
much simplier to type it: "S_Gift Finder_0".
So either you wanted some other character, or your problem is in some
other place and you want to solve it (no hope) by escaping chars.
 
M

marss

_ is underscore symbol.

Try this:
document.forms["giftfinder"].all["S_Gift Finder1_0"].value
 
S

skinnybloke

Thanks for the replies guys. I eventuallty found a way to remove the
space from the name within the package.

I was then able to use S_GiftFinder1_0 as the field name as suggested.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top