Link to home
Start Free TrialLog in
Avatar of ioanna78
ioanna78

asked on

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

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
ASKER CERTIFIED SOLUTION
Avatar of jimmy282
jimmy282
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ioanna78
ioanna78

ASKER

10000000000000 kisses!!!!!!!!!
you were realy quick and helpful, i'll give you all my points (75).
Thanks for the points and the kisses!

Lol

Jimmy