![]() |
|
|
Textarea formatting replacing vbCrLf with <br>When you enter text into a textarea in a HTML form and press enter for line breaks on your keyboard the line breaks are removed and not preserved when you display the entered text on a web page that receives the textarea value. For example below we have the code for two pages "form.asp" and "form_receive.asp". form.asp:
<html> form_receive.asp:
<html> In practice the code for "form.asp" would
display a textarea such as the one below. (note that the textarea
below is just an example and the submit button won't work) The page would display; Hi,Thanks for the invite. Regards,Michael. The simple explanation is that when you enter a carriage return into the textarea box the browser won’t pick up carriage returns. To maintain the carriage return we could simply replace the carriage return with the <br> tag using the Replace function. To ensure proper formatting our code for "receive_form.asp" would look like this:
<html> If you have any code snippets to share with full credit given then send an email to Codesnippets - You'll receive full credit and a link back to your site. Site developed by Michael Wall - Web Design Belfast N.Ireland. |
|