Input fields

An input field is a named value. You name it and you determine what it means by setting its value. The value is associated with the input field name. You can have several fields with the same name and they all display the same value. If the user edits one of them, they all change.

In this sample text, an input field for the customer’s name is repeated throughout:

In a script, you can set the value of the customer field:

rte_1.InputFieldChangeData("customer", "Mary")

Then the text would look like this:

The user can also set the value. There are two methods:

Inserting input fields in a script The InputFieldInsert function inserts a field at the insertion point:

rtn = rte_1.InputFieldInsert("datafield")

In a rich text editing application, you might want the user to insert input fields. The user needs a way to specify the input field name.

In this example, the user selects a name from a ListBox containing possible input field names. The script inserts an input field at the insertion point using the selected name:

string ls_field
integer rtn

ls_field = lb_fields.SelectedItem()
IF ls_field <> "" THEN
   rtn = rte_1.InputFieldInsert( ls_field )
   IF rtn = -1 THEN
   MessageBox("Error", "Cannot insert field.")
   END IF
ELSE
   MessageBox("No Selection", &
      "Please select an input field name.")
END IF

Input fields for dates and page numbers

To display a date or a page number in a printed document, you define an input field and set the input field’s value.

StepsTo include today’s date in the opening of a letter, you might:

  1. Create an input field in the text. Name it anything you want.

  2. In the script that opens the window or some other script, set the value of the input field to the current date.

For example, if the body of the letter included an input field called TODAY, you would write a script like the following to set it:

integer li_rtn
li_rtn = rte_1.InputFieldChangeData( "today", &
   String(Today()) )

For information about setting page number values see “What the user sees”.