Class

# DBKit.TextField

<div class="rst-class">

forsearch

</div>

DBKit.TextField

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Displays and edits the value of a single database column for the current row.

Set `ColumnName<dbkit.textfield.columnname>` to the column you want the field bound to. When the current row changes, the field shows the column's value; when the user edits the field, the new value is written back to the row automatically.

Only the members declared by <span class="title-ref">DBKit.TextField</span> itself are described here; for the inherited members, see `the parent classes<dbkit.textfield.seealso>`.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                       | Type                               | Read-Only | Shared |
|------------------------------------------------------------|------------------------------------|-----------|--------|
| `ColumnName<dbkit.textfield.columnname>`                   | `String</api/data_types/string>`   |           |        |
| `DisplayName<dbkit.textfield.displayname>`                 | `String</api/data_types/string>`   |           |        |
| `InvalidValueMessage<dbkit.textfield.invalidvaluemessage>` | `String</api/data_types/string>`   |           |        |
| `Mandatory<dbkit.textfield.mandatory>`                     | `Boolean</api/data_types/boolean>` |           |        |
| `Titlecase<dbkit.textfield.titlecase>`                     | `Boolean</api/data_types/boolean>` |           |        |
| `TrimSpaces<dbkit.textfield.trimspaces>`                   | `Boolean</api/data_types/boolean>` |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                   | Parameters | Returns                          | Shared |
|----------------------------------------|------------|----------------------------------|--------|
| `TableName<dbkit.textfield.tablename>` |            | `String</api/data_types/string>` |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                             | Parameters                                   | Returns |
|--------------------------------------------------|----------------------------------------------|---------|
| `RowChanged<dbkit.textfield.rowchanged>`         | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowCreated<dbkit.textfield.rowcreated>`         | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowDeleted<dbkit.textfield.rowdeleted>`         | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowEditing<dbkit.textfield.rowediting>`         | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowLoaded<dbkit.textfield.rowloaded>`           | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowNotSelected<dbkit.textfield.rownotselected>` |                                              |         |
| `RowSaved<dbkit.textfield.rowsaved>`             | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowSaving<dbkit.textfield.rowsaving>`           | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowUndone<dbkit.textfield.rowundone>`           | row As `DBKit.Row</api/databases/dbkit/row>` |         |

## Property descriptions

<div id="dbkit.textfield.columnname">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.ColumnName

**ColumnName** As `String</api/data_types/string>`

> The name of the database column whose value this control displays and edits.
>
> If blank, the control's name is used as the column name. The name may be qualified with a table name (for example "tablename.columnname") when the control shows a column from a related table.
>
> <div class="tip">
>
> <div class="title">
>
> Tip
>
> </div>
>
> Instead of setting this property, you can name the control the same as the database column. DBKit first looks at the ColumnName property; if it is blank, it then uses the name of the control itself.
>
> </div>

<div id="dbkit.textfield.displayname">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.DisplayName

**DisplayName** As `String</api/data_types/string>`

> A user-friendly name for the control, shown to the user in place of the column name (for example in the `InvalidValueMessage<dbkit.textfield.invalidvaluemessage>`).
>
> If blank, the column name is de-camelcased automatically (for example "FirstName" becomes "First Name").

<div id="dbkit.textfield.invalidvaluemessage">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.InvalidValueMessage

**InvalidValueMessage** As `String</api/data_types/string>`

> The message displayed when the field is mandatory but has no value. Use \<\$1\> as a placeholder for the control's display name.
>
> The default is "\<\$1\> must have a value."

<div id="dbkit.textfield.mandatory">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.Mandatory

**Mandatory** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, the field must contain a value before the row can be saved. When a row with an empty mandatory field is saved, the `InvalidValueMessage<dbkit.textfield.invalidvaluemessage>` is displayed and the save is cancelled.
>
> The default is `False</api/language/false>`.

<div id="dbkit.textfield.titlecase">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.Titlecase

**Titlecase** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, the text is converted to title case as it is typed.
>
> The default is `False</api/language/false>`.

<div id="dbkit.textfield.trimspaces">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.TrimSpaces

**TrimSpaces** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, leading and trailing spaces are removed from the text when the control loses focus.
>
> The default is `True</api/language/true>`.

## Method descriptions

<div id="dbkit.textfield.tablename">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.TableName

**TableName**() As `String</api/data_types/string>`

> Returns the name of the database table the control's column belongs to. If the `ColumnName<dbkit.textfield.columnname>` is qualified with a table name (for example "tablename.columnname"), that table name is returned; otherwise the table is resolved from the control's layout.

## Event descriptions

<div id="dbkit.textfield.rowchanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.RowChanged

**RowChanged**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The current row (passed to the event) has been changed.

<div id="dbkit.textfield.rowcreated">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.RowCreated

**RowCreated**(row As `DBKit.Row</api/databases/dbkit/row>`)

> A new row (passed to the event) was just created and is now the current row.

<div id="dbkit.textfield.rowdeleted">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.RowDeleted

**RowDeleted**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The current row (passed to the event) has been deleted.

<div id="dbkit.textfield.rowediting">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.RowEditing

**RowEditing**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The current row (passed to the event) is being edited by the user.

<div id="dbkit.textfield.rowloaded">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.RowLoaded

**RowLoaded**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The current row (passed to the event) has been loaded.

<div id="dbkit.textfield.rownotselected">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.RowNotSelected

**RowNotSelected**

> There is no row currently selected.

<div id="dbkit.textfield.rowsaved">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.RowSaved

**RowSaved**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The current row (passed to the event) has been saved.

<div id="dbkit.textfield.rowsaving">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.RowSaving

**RowSaving**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The current row (passed to this event) is about to be saved.

<div id="dbkit.textfield.rowundone">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.TextField.RowUndone

**RowUndone**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The changes made to the current row (passed to this event) have been undone.

## Notes

### Read-only instead of disabled

When a row is displayed but not being edited, the control remains enabled but is read-only. It is only disabled when no row is selected.

### Automatic hints

If the layout's AutomaticHints property (`Window<dbkit.window.automatichints>`, `Page<dbkit.page.automatichints>`, `Container<dbkit.container.automatichints>`) is `True</api/language/true>` (the default) and the control's Hint is empty, the Hint is set to the control's `display name<dbkit.textfield.displayname>` when the control opens. The display name is the `DisplayName<dbkit.textfield.displayname>` property if set, otherwise the column name with camel-case words split apart, so LastName is shown as "Last Name".

### Localization

Localize the control's user-facing text (`InvalidValueMessage<dbkit.textfield.invalidvaluemessage>`) the standard Xojo way: assign a dynamic constant to each property and provide translations for as many languages as you need, or localize the property values directly.

## Compatibility

|                       |              |
|-----------------------|--------------|
| **Project Types**     | Desktop, Web |
| **Operating Systems** | All          |

<div id="dbkit.textfield.seealso">

<div class="seealso">

`DesktopTextField</api/user_interface/desktop/desktoptextfield>` (desktop) and `WebTextField</api/user_interface/web/webtextfield>` (web) parent classes; `DBKit.Row</api/databases/dbkit/row>` class.

</div>

</div>
