Solved

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

Posted on 2002-03-12
3
398 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now