Input Context [Input]Any Text[/Input]
Prepares text for use in input forms such as <textarea> tags.

To prepare text fields that may contain carriage returns for use in <textarea> portions of a form, place them inside an [Input] context. Certain characters, such as carriage returns, are converted to "soft-returns" when they are saved in a database file. The [Input] context converts them back to "hard-returns" so they look right when displayed inside <textarea> tags. Other characters, such as "<" and ">" cause the <textarea> tag to get confused, so they are converted to "&lt;" and "&gt" in order to display properly.

Example (normally you would put the following text into a .tpl file on your server and use a web browser to link to it):


This context is most often used when you create a form allowing visitors to edit (replace a record) with large portions of text in a database field that has carriage returns in it. If you do not use this context, then the lines of text inside the <textarea> multiline input field will appear to have "lost" all the carriage returns that were originally there. This is because web browsers do not understand how to display a "soft-return" character, so it appears as a simple space instead.

Note: there is probably no reason to ever use this context unless it is inside <textarea>, because no other input field allows carriage returns to be typed into it.

Here is a list of exactly what happens to text when it is put inside an [Input] context:
If the character is...
then it is translated to...
Soft-return (%0B) Hard-return (%0D)
< &lt;
> &gt;
& &amp;
" &quot;
Any other character no change

User Contributed Notes

Terry Wilson - 
04/01/2003 at 10:09:02
Actually, there is another use for [input] and SMSI shouldn't state: "Note: there is probably no reason to ever use this context unless it is inside <textarea>..."

Since [input] also fixes quote marks, you will need this when a quote mark would be misinterpreted, as in an alt tag:

<img src="art/[filename]" border="0" alt="[input][title][/input]">

If [title] contained a quote mark, it would stop the alt text right there.

Copyright © 2008 WebDNA Software Corporation, Inc.