Difference between revisions of "Text form field type"

From Joomla! Documentation

(Added filter as optional parameter, added two examples.)
m
Line 24: Line 24:
  
 
Use the raw filter to ensure that html code is preserved when the form is processed.
 
Use the raw filter to ensure that html code is preserved when the form is processed.
<source lang="xml"><field name="myintvalue" 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>
 
<noinclude>
 
<noinclude>
 
=== See also ===
 
=== See also ===

Revision as of 07:05, 30 October 2011

Params.text.jpg

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) (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)
  • disabled (optional)
  • filter (optional) allow the system to save certain html tags or raw data.

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[edit]