Hi,
I have created a html Page that allows a user to input data to a textarea on a form. On this I am using a Javascript function to ensure line returns are maintained by inserting <br> tags. This method, Validate(), is called when the form is submitted.
My problem however is this: Once the form is submitted it inserts <br> tags into the textarea. How can I display the data in the textarea without <br> tags while sending the contents of the textarea to the next page with <br> tags??
Any help would be greatly appreciated
Regards
<script type="text/javascript">
<!--
function validate()
{
var Txt = window.document.theForm.bodyText.value;
while (Txt.search("\n"
> -1) {
Txt = Txt.replace ("\n","<br>"
;
window.document.theForm.bodyText.value = Txt;
}
}
function valBodyText()
{
var Text = window.document.theForm.bodyText.value;
while (Text.search("<br>"
> -1) {
Text = Text.replace ("<br>","\n"
;
}
}
-->
</script>
<body onload = "valBodyText()">
<form name = "theForm" method = "post" action = "createBasic.asp" enctype="multipart/form-data" onSubmit="validate()">
<font size="2" face="Arial">Insert the <b>text</b> in the box below that
you would like to appear on your home page<br>
<textarea name="bodyText" rows="10" cols="70" wrap="virtual">
<%=rsGetValues("TextBody"
%>
</textarea>
<center><input type="submit" value="Test My WebPage">
</form>
</body>
</html>
I have created a html Page that allows a user to input data to a textarea on a form. On this I am using a Javascript function to ensure line returns are maintained by inserting <br> tags. This method, Validate(), is called when the form is submitted.
My problem however is this: Once the form is submitted it inserts <br> tags into the textarea. How can I display the data in the textarea without <br> tags while sending the contents of the textarea to the next page with <br> tags??
Any help would be greatly appreciated
Regards
<script type="text/javascript">
<!--
function validate()
{
var Txt = window.document.theForm.bodyText.value;
while (Txt.search("\n"
Txt = Txt.replace ("\n","<br>"
window.document.theForm.bodyText.value = Txt;
}
}
function valBodyText()
{
var Text = window.document.theForm.bodyText.value;
while (Text.search("<br>"
Text = Text.replace ("<br>","\n"
}
}
-->
</script>
<body onload = "valBodyText()">
<form name = "theForm" method = "post" action = "createBasic.asp" enctype="multipart/form-data" onSubmit="validate()">
<font size="2" face="Arial">Insert the <b>text</b> in the box below that
you would like to appear on your home page<br>
<textarea name="bodyText" rows="10" cols="70" wrap="virtual">
<%=rsGetValues("TextBody"
</textarea>
<center><input type="submit" value="Test My WebPage">
</form>
</body>
</html>