I've put up a form on my website that is supposed to pass the entered values from one page to a new page that opens and show the data exactly as typed on the new page. I'm using a javascript that I got from another javascript site that i have modified to fit my needs. For some reason, any spaces that are input into the form are still being displayed on the next page as "+" signs. For example, if I input "New York," it will show up on the new page as "New+York." How do I fix this problem? There is already coding in place that uses the unescape function, but it still won't display properly. Could someone please have a look at my webpage to see if they can figure out the problem? It's at melaniestype.com/serviceagreement.html. The output form is at melaniestype.com/serviceagreementoutput.html. I'd appreciate a quick response. Thanks.
Thanks a lot, you guys. I had already used your idea, Willy, before Glenn had a chance to post, and I don't really understand how your code works, Glenn. I follow it kind of, but I don't understand the namVal or the brackets with [0] and [1] following namVal. Would "namVal" go in place of the names I have, i.e. "requiredclientname"...? Could you explain that code to me, Glenn, in basic terms?
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
Maybe this is clearer...
var name, value, nameVal;
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split('='); //returns an array with 2 items
name = unescape(nameVal[0].replace(/\+/g, " ")); //unescape item 1 from the array and replace +'s with spaces
value = unescape(nameVal[1].replace(/\+/g, " ")); //unescape item 2 from the array and replace +'s with spaces
params[name] = value; //put the name-value in "hash array"
}
and then you access the names like these:
var requiredclientname = params["requiredclientname"];
var requiredclientID = params["requiredclientID"];
Read the links I posted for more comprehensive discussion on this topic.
That IS a lot clearer. Boy, this site is a very big help. I had been trying my best to fix the problem myself to no avail. I'm glad you guys were there to help. Thanks again. Take care