Solved

unable to execute URLEncodedFormat when using window.location.href in a javascript

Posted on 2002-03-12
3
401 Views
Last Modified: 2013-12-24
i have an html form in a cfm file and i want to get the value of a textarea before the form is submited, so i use a javascript to get this value and to reload the file the passed through the URL. the textarea may have special characters so i must use URLEncodedFormat, the problem is that when i use this it returns the name of the variable not the value. see the code bellow:

<script>
function check_answer()
{
var answer_text=document.form1.textarea1.value;
<CFOUTPUT>
window.location.href="test.cfm?answer_text=#URLEncodedFormat("+answer_text+")#";
</CFOUTPUT>
}
</script>

when i print the answer_text in test.cfm i get +answer_text+

i don't have any problem to use another method in order to get the value of the textarea

any help is welcome ioanna
0
Comment
Question by:ioanna78
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
jimmy282 earned 75 total points
ID: 6856891
<script>
function check_answer()
{
var answer_text=document.form1.textarea1.value;
window.location.href="test.cfm?answer_text= + escape(answer_text);
}
</script>

This may help.
Jimmy

0
 

Author Comment

by:ioanna78
ID: 6857035
10000000000000 kisses!!!!!!!!!
you were realy quick and helpful, i'll give you all my points (75).
0
 
LVL 11

Expert Comment

by:jimmy282
ID: 6857056
Thanks for the points and the kisses!

Lol

Jimmy
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question