This tip will show you how to modify a standard text field to display as a textarea tag for web users. A textarea is an alternative to a plain text box. The main difference is that a textarea can hold more than one line of text -- in other words, users can enter new lines to separate their lines of text. Also, if the user enters more text than the box can display horizontally, the text will wrap to the next line. If the user enters more lines than the box can display vertically, the scrollbar will become active so that the user can scroll up and down.

Click here to see a demonstration of this tip!

To get more information on developing Domino 6 web applications check out TLCC's Developing Domino 6 Web Applications course.
Click here to get more information on this course.

IBM Employees - click on the following link to get information on ordering this course at the IBM Global Campus!
Click here to get more information on this course at the IBM Global Campus.




Converting a Text field to a Textarea field for Domino Web Users

Standard text fields in Domino are displayed on a web browser using the input html tag when the form is in edit mode. This will display one line for input as shown in the following image. The length of this input field can be modified using the html attributes and setting the length attribute to a given number of characters.




If the user has to edit a large amount of text the standard input field can be a bit confining. One solution is to use a Domino rich text field. This will use the textarea html tag to display the field as shown below:




Using a rich text field however means the field will be stored as Domino rich text and can not be displayed in a view or used in many Domino formulas.

Another way to get Domino to use a textarea tag is to set the text field to accept multiple values. This tip will show you how to trick Domino to display a text field using a textarea tag and how to make sure your data is stored the way you want it to be stored.




Procedure: Turning a Field into a Textarea

  1. Open the field's properties box.
  2. On the Info tab, check the "Allow multiple values" setting.


  3. On the Advanced tab, under Multi-Value Options, set the "Separate values when user enters" property to "New Line" or "Blank Line". Make sure no other options are checked.


  4. Save the form.



Tip
Multiple Values

This technique sets the field to allow multiple values. This means that a single piece of data may be saved on the Notes document as a list of values. For instance, if the user was entering a product description, and used a carriage return to enter it on two lines, those two lines will be considered separate values by Domino if the field's properties were set as shown above.

To eliminate this problem, use an Input Translation formula for the field to convert multiple values back to a single value. This is easily done using the @Implode function, as in:





The Textarea HTML Tag

Textareas are one of the few types of input object that does not use the <input> tag. Instead, they use their own tag, <textarea>. Here's an example of a textarea tag:
<textarea name="Description" rows="3" cols="20">Default value</textarea>

The <textarea> tag has one required attribute, name. Like the name attribute of an input tag, this attribute identifies the textarea to the browser. Its value is taken from the name of the Domino field.

Textareas do not have a "value" attribute for specifying a default value. Instead, the result of the Domino default value formula will be inserted between the opening and closing <textarea> tags, as shown in the example above.

The rows and cols attributes are used to indicated the display size of the textarea. For instance, if rows=20 is specified, the textarea will be twenty lines of text high. If cols=50 is specified, the textarea will be fifty characters wide. Set the HTML Attributes as shown in the following image: