EWD uses a special Session array for textarea fields: the textarea array. Let's imagine we want an HTML form in our EWD page that contains a textarea tag that displays a set of notes or comments. In your EWD page you would simply have the following:

   Notes: <textarea name="notes" rows="20" cols="100">*</textarea>

Note that you don't define any logic in the EWD page to define how the textarea is pre-populated with text. All this logic is placed in the page's pre-page script. Note also the asterisk ("*") between the textarea and /textarea tags. This is essential for the text to be displayed. The closing /textarea tag must be on the same line as the opening tag.

To pre-populate the textarea tag when the page is displayed, in the page's pre-page script, create the corresponding EWD textarea Array, mapping via the field's name, eg

  s text(1)="This is the first line of notes"
  s text(2)="This is the second line of notes"
  s text(3)="This is the last line of notes"
  d createTextArea^%zewdAPI("notes",.text,sessid)

In this case the contents of the local array text are merged into the textarea Session array. The structure of the local array is:

  text(lineNo) = line of text

Of course, typically you'll determine the text you'll display based on information retrieved from the database.

When the form is submitted, the text in the textarea field is copied automatically into the EWD textarea Array. The form's Action Script can merge the EWD textarea array to a local array and can then validate and process it, eg:

 d getTextArea^%zewdAPI("notes",.notes,sessid)

Click the Enterprise Web Developer/Examples tab for worked examples.