Actions

Difference between revisions of "Integer form field type"

From Joomla! Documentation

(This is a form field, not a parameter.)
Line 1: Line 1:
The '''integer''' parameter type provides a select box with a range of integer values. If the parameter has a value saved, this value is displayed when the page is first loaded. If not, the default value (if any) is selected.  
+
The '''integer''' form field type provides a select box with a range of integer values. 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 ''integer''.
 
* '''type''' (mandatory) must be ''integer''.
* '''name''' (mandatory) is the unique name of the parameter.
+
* '''name''' (mandatory) is the unique name of the field.
 
* '''label''' (mandatory) (translatable) is the descriptive title of the field.
 
* '''label''' (mandatory) (translatable) is the descriptive title of the field.
 
* '''default''' (optional) (translatable) is the default value.
 
* '''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.
 
* '''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'.
 
* '''class''' (optional)  is a CSS class name for the HTML form field.  If omitted this will default to 'text_area'.
 
 
* '''first''' (mandatory) this value is the lowest on the list.
 
* '''first''' (mandatory) this value is the lowest on the list.
 
* '''last''' (mandatory) this value is the highest on the list.
 
* '''last''' (mandatory) this value is the highest on the list.
* '''step''' (mandatory) each option will be in incrementation of this integer, based on the '''first''' value until '''last''' value is reached
+
* '''step''' (mandatory) each option will be the previous option incremented by this integer, starting with the '''first''' value until the '''last''' value is reached.
  
Example XML parameter definition which would create a select box with the choices of 1,2,3,4,5,6,7,8,9,10:
+
Example XML field definition which would create a select box with the choices of 1,2,3,4,5,6,7,8,9,10:
<source lang="xml"><param name="myintegeralue" type="integer" default="Some integer" label="Choose an integer" description="" first="1" last="10" step="1" /></source>
+
<source lang="xml"><field name="myintegeralue" type="integer" default="Some integer" label="Choose an integer" description="" first="1" last="10" step="1" /></source>
 
<noinclude>
 
<noinclude>
 
=== See also ===
 
=== See also ===
* [[Standard form field types|Table of all standard form field types]]
+
* [[Standard form field types|List of standard form field types]]
 
[[Category:Standard form field types]]</noinclude>
 
[[Category:Standard form field types]]</noinclude>

Revision as of 15:29, 20 May 2011

The integer form field type provides a select box with a range of integer values. 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 integer.
  • name (mandatory) is the unique name of the field.
  • label (mandatory) (translatable) is the descriptive title of the field.
  • 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'.
  • first (mandatory) this value is the lowest on the list.
  • last (mandatory) this value is the highest on the list.
  • step (mandatory) each option will be the previous option incremented by this integer, starting with the first value until the last value is reached.

Example XML field definition which would create a select box with the choices of 1,2,3,4,5,6,7,8,9,10:

<field name="myintegeralue" type="integer" default="Some integer" label="Choose an integer" description="" first="1" last="10" step="1" />

See also