Joomla text Form Field Type

The text form field type provides a text box for data entry. If the field has a value saved, this value is displayed when the page is first loaded. If not, the default value (if any) is selected.

XML Field Definition

<field
name="mytext"
type="text"
default="Some text"
label="Enter Text" />

Use the integer filter to ensure that letters get stripped when the form is processed.

<field 
name="myintvalue"
type="text"
default=""
label="Enter some text"
description="Enter some description"
filter="integer" />

Use the raw filter to ensure that html code is preserved when the form is processed.

<field 
name="myhtmlvalue"
type="text"
default=""
label="Enter some text"
description="Enter some description"
filter="raw" />

Additional Parameters

1. maxlength: The allowable maxlength of the field. It limits the number of characters that may be entered.

2. charcounter: If set to true, a characater counter is displayed at the form field. You must also use maxlength attribute along with this.

3. inputmode: (text, decimal, numeric, tel, search, url) The mode of input associated with the field.

4. addonBefore: Text that is displayed before the input field group. For example, you can add currency symbol.

5. addonAfter: Text that is displayed after the input field group. For example, you can add units like px.

Examples

1. Title Field (com_content)

<field
name="title"
type="text"
label="JGLOBAL_TITLE"
required="true"
maxlength="255" />

2, Alias Field (com_content)

<field
name="alias"
type="text"
label="JFIELD_ALIAS_LABEL"
description="JFIELD_ALIAS_DESC"
hint="JFIELD_ALIAS_PLACEHOLDER" />

3. Ordering Field (com_content)

<field
name="ordering"
type="text"
label="JFIELD_ORDERING_LABEL"
default="0" />

4. Site Name Field (Global Configuration)

<field
name="sitename"
type="text"
label="COM_CONFIG_FIELD_SITE_NAME_LABEL"
required="true"
filter="string" />