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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Losing CR / LF in TextArea w/vbscript

Status
Not open for further replies.

JohnBeals

Programmer
Feb 26, 2002
49
US
When submitting a form using vbscript, I loose the CR/LFs.
If I use a submit button instead of vbscript, the CR/LFs are passed.

Using vbscript:
Code:
Sub btnOK_onclick
Dim Comments
Comments = document.forms(0).txtComments.value
window.navigate(nextpage.cfm?Comments=" & Comments)
In the code
Code:
<FORM name=frmStuff>
<textarea cols=&quot;80&quot; rows=&quot;4&quot; name=&quot;txtComments&quot; id=&quot;txtComments&quot; wrap=&quot;soft&quot;>
<INPUT id=btnOK name=btnOK type=button value=OK>
</form>
The above process causes the loss of CR/LFs in my code. However, if I use the standard Submit button to submit the form, the CR/LFs get saved.

What am I doing wrong?
Thanks,
John
 
i'd say that you're losing the CR/LFs because you're taking the value of that field and passing it via the querystring. i'd try using code to actually do the form.submit, instead of passing the data via your querystring.

Code:
Sub btnOK_onclick
    document.forms(0).submit
End Sub
 
Ahhh. That looks like that will do it. I will then still be able to validate the form before submitting using Vbscript.
Thanks Paul!
JB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top