Actions

Difference between revisions of "Text form field type"

From Joomla! Documentation

(Update read only and disabled descriptions and add required attribute)
(link fixed)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
<noinclude><languages /></noinclude>
 +
 +
<translate><!--T:1-->
 +
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.</translate>
 
[[Image:Params.text.jpg|right]]
 
[[Image:Params.text.jpg|right]]
 +
<translate><!--T:2-->
 +
* '''type''' (mandatory) must be ''text''.</translate>
 +
<translate><!--T:3-->
 +
* '''name''' (mandatory) is the unique name of the field.</translate>
 +
<translate><!--T:4-->
 +
* '''label''' (mandatory) (translatable) is the descriptive title of the field.</translate>
 +
<translate><!--T:5-->
 +
* '''size''' (optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.</translate>
 +
<translate><!--T:6-->
 +
* '''maxlength''' (optional) limits the number of characters that may be entered.</translate>
 +
<translate><!--T:7-->
 +
* '''default''' (optional) (not translatable) is the default value.</translate>
 +
<translate><!--T:8-->
 +
* '''description''' (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.</translate>
 +
<translate><!--T:9-->
 +
* '''class''' (optional) is a CSS class name for the HTML form field. If omitted this will default to 'text_area'.</translate>
 +
<translate><!--T:10-->
 +
* '''readonly''' (optional) The field cannot be changed and will automatically inherit the default value</translate>
 +
<translate><!--T:11-->
 +
* '''disabled''' (optional) The field cannot be changed and will automatically inherit the default value - it will also not submit</translate>
 +
<translate><!--T:12-->
 +
* '''required''' (optional) The field must be filled before submitting the form.</translate>
 +
<translate><!--T:13-->
 +
* '''filter''' (optional) allow the system to save certain html tags or raw data.</translate>
 +
<translate><!--T:14-->
 +
* '''message''' (optional) The error message that will be displayed instead of the default message.</translate>
  
{{Ambox|type=notice|text=In Joomla! 1.5, [[Form field|form fields]] were [[Parameter|parameters]]. For that version, you may want to use the corresponding [[Text parameter type]].}}
+
<translate><!--T:15-->
 
+
Example XML field definition:</translate>
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.
+
 
+
* '''type''' (mandatory) must be ''text''.
+
* '''name''' (mandatory) is the unique name of the field.
+
* '''label''' (mandatory) (translatable) is the descriptive title of the field.
+
* '''size''' (optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.
+
* '''maxlength''' (optional) limits the number of characters that may be entered.
+
* '''default''' (optional) (not translatable) is the default value.
+
* '''description''' (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
+
* '''class''' (optional) is a CSS class name for the HTML form field. If omitted this will default to 'text_area'.
+
* '''readonly''' (optional) The field cannot be changed and will automatically inherit the default value
+
* '''disabled''' (optional) The field cannot be changed and will automatically inherit the default value - it will also not submit
+
* '''required''' (optional) The field must be filled before submitting the form.
+
* '''filter''' (optional) allow the system to save certain html tags or raw data.
+
 
+
Example XML field definition:
+
 
<source lang="xml"><field name="mytextvalue" type="text" default="Some text" label="Enter some text" description="" size="10" /></source>
 
<source lang="xml"><field name="mytextvalue" type="text" default="Some text" label="Enter some text" description="" size="10" /></source>
  
Use the integer filter to ensure that letters types get stripped when the form is processed.
+
<translate><!--T:16-->
 +
Use the integer filter to ensure that letters types get stripped when the form is processed.</translate>
 
<source lang="xml"><field name="myintvalue" type="text" default="8" label="Enter some text" description="Enter some description" filter="integer" /></source>
 
<source lang="xml"><field name="myintvalue" type="text" default="8" label="Enter some text" description="Enter some description" filter="integer" /></source>
  
Use the raw filter to ensure that html code is preserved when the form is processed.
+
<translate><!--T:17-->
 +
Use the raw filter to ensure that html code is preserved when the form is processed.</translate>
 
<source lang="xml"><field name="myhtmlvalue" type="text" default="" label="Enter some text" description="Enter some description" filter="raw" /></source>
 
<source lang="xml"><field name="myhtmlvalue" type="text" default="" label="Enter some text" description="Enter some description" filter="raw" /></source>
 +
 +
<translate>=== See also === <!--T:18--></translate>
 +
<translate>
 +
<!--T:19-->
 +
* [[S:MyLanguage/Textarea form field type|Textarea form field type]]
 +
* [[S:MyLanguage/Standard form field types|List of standard form field types]]
 +
</translate>
 +
 
<noinclude>
 
<noinclude>
=== See also ===
+
<translate>
* [[Textarea form field type]]
+
<!--T:20-->
* [[Standard form field types|List of standard form field types]]
+
[[Category:Standard form field types]]
[[Category:Standard form field types]]</noinclude>
+
</translate>
 +
</noinclude>

Latest revision as of 13:00, 9 August 2015

Other languages:
English • ‎français

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.

Params.text.jpg
  • type (mandatory) must be text.
  • name (mandatory) is the unique name of the field.
  • label (mandatory) (translatable) is the descriptive title of the field.
  • size (optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.
  • maxlength (optional) limits the number of characters that may be entered.
  • default (optional) (not translatable) is the default value.
  • description (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
  • class (optional) is a CSS class name for the HTML form field. If omitted this will default to 'text_area'.
  • readonly (optional) The field cannot be changed and will automatically inherit the default value
  • disabled (optional) The field cannot be changed and will automatically inherit the default value - it will also not submit
  • required (optional) The field must be filled before submitting the form.
  • filter (optional) allow the system to save certain html tags or raw data.
  • message (optional) The error message that will be displayed instead of the default message.

Example XML field definition:

<field name="mytextvalue" type="text" default="Some text" label="Enter some text" description="" size="10" />

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

<field name="myintvalue" type="text" default="8" 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" />

See also