Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with the pasted text

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
CA
Hi,

I have a text box on my form
<TEXTAREA NAME="name2" ROWS="7" COLS="65" wrap=off></TEXTAREA>

The problem is when someone instead of typing, pastes some text (say e-mail) and proceeds to the next page, the pasted text is converted into the HTML and is displayed on the next page (which should not happen!!!)

Please help me to resove this issue.

Thanks.
 
I'm not sure I understand what the purpose of the next page is...

What is your form action? Is that the next page? We need more info!

[cheers]
Cheers!
Laura
 
well, next page is the continuation of the user form, I pass the values caputered in the form from one page to another....

 
how do you pass them? please be specific!!

[cheers]
Cheers!
Laura
 
First page:

<form method="post" action="order4.asp" onSubmit="return ValidateFields()" name="form1">
......
<TEXTAREA NAME="name2" ROWS="7" COLS="65" wrap=off></TEXTAREA>
......
</form>


Next page (order4.asp)
strText = request.form("name2")

<form method="post" action="order5.asp" onSubmit="return ValidateFields()" name="form1">
....

</form>


The problem is the pasted text gets converted into the HTML and is printed on the second page.



 
Hmmm this seems to be an ASP issue...

Can you show us the code where the text is appearing? or send us a link to an example?

[cheers]
Cheers!
Laura
 
What do you do with strText in order4.asp?
Do you put it in another textarea or into a hidden input or... ?

--Dave
 
I can't send the link (it's an Intranet page)

and there is no code that would show the content of the textarea box on the second page

the only thing I do is I capture the value into the variable as I show before (strText = request.form("name2"))
 
Yes,

I then put strText into the hidden textarea to pass it to the next page


<TEXTAREA style='display: block' NAME="name2" id="text" ROWS="7" COLS="65" wrap=off Value = '<%Response.write(name2)%>'>
 
Oh,
I am sorry, it's just for my testing purposes here, I have changed style='display: none' to style='display: block'

 
Try this slight modification:

Code:
<TEXTAREA style='display: block' NAME="name2" id="text" ROWS="7" COLS="65" wrap=off Value = ''>
<script>
formName.name2.innerText = '<%Response.write(name2%>';
</script>

...and if that doesn't work:

formName.name2.innerHTML = '<%Response.write(name2%>';

...and finally:

formName.name2.value = '<%Response.write(name2%>';

...OR:

Code:
<[b]input type='hidden'[/b] NAME="name2" id="text" [s]ROWS="7" COLS="65" wrap=off[/s] Value = '<%Response.write(name2%>' />

In fact, maybe try this first.

The style you show in your "hidden" textarea is set to show the textarea (block) instead of hide it (none).

Also, what is an example of a value that was pasted that is now shown as HTML? Are there HTML tags in it?

--Dave
 
Oops, ignore my:

The style you show in your "hidden" textarea is set to show the textarea (block) instead of hide it (none).

--Dave
 
LookingForInfo,

I have tried all your methods, did not seem to work...

first two passed the blank,

<input type='hidden' NAME="name2" id="text" ROWS="7" COLS="65" wrap=off Value = '<%Response.write(name2%>' /> would cut off the text, I guess the text box lenght is limited.


The example of the pasted text does not contain any HTML tags, it does contain the e-mail addresses though...

Thanks for your help anyway! Appreciate it very much...

 
Ack! I see you cut-and-paste my code! Mistake! :)

Instead of:

<input type='hidden' NAME="name2" id="text" ROWS="7" COLS="65" wrap=off Value = '<%Response.write(name2%>' />

Try:

<input type='hidden' NAME="name2" id="text" value = '<%Response.write(strText)%>' />

Notice I changed Value to value (lower-case 'v'), took name2 out and put strText in, and remembered my close-parenthesis on the Response.write statement.

Whatever you do, make "Value" into "value" (lower-case 'v') and, hen you retrieve the value, retrieve it with a lower-case 'v'.

Finally, add an alert message somewhere:

alert('<%Response.write(strText)%>');

...and see what it does.

--Dave
 
Input boxes might as well have limited storage and cut off your text. But when you claim you're putting information in a textarea on the second page, you are actually not. Textarea has no value attribute. All the information inside textarea is inbetween opening and closing textarea tag. Thus your code should look like:
Code:
<textarea style="display: none;" name="name2" id="text"><%Response.Write(strText)%></textarea>
I got rid of most textarea attributes that are not relevant when textarea is hidden.
 
Vragabond,

You were right. Your tip helped me solve this issue. Thanks a lot!!!

LookingForInfo, thank you again for all your help too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top