Actions

Difference between revisions of "Checkbox form field type"

From Joomla! Documentation

m (Example corrected as well)
Line 11: Line 11:
 
<source lang="xml"><field name="mycheckbox" type="checkbox" label="Show title" description="" value="1" /></source>
 
<source lang="xml"><field name="mycheckbox" type="checkbox" label="Show title" description="" value="1" /></source>
 
<noinclude>
 
<noinclude>
 +
 +
=== Example ===
 +
<source>
 +
<field
 +
name="kitchen_distribution_option_1"
 +
id="kitchen-distribution-option_1"
 +
type="checkbox"
 +
label="COM_COTIZACION_KITCHEN_DISTRIBUTION_OPTION_1_LABEL"
 +
description="COM_COTIZACION_KITCHEN_DISTRIBUTION_OPTION_1_DESC"
 +
value="1"
 +
/>
 +
</source>
 +
 +
 
=== See also ===
 
=== See also ===
 
* [[Standard form field types|List of 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 11:22, 31 July 2012

The checkbox form field type provides a single checkbox. If the parameter has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.

  • type (mandatory) must be checkbox
  • name (mandatory) is the unique name of the parameter.
  • label (mandatory) (translatable) is the descriptive title of the field.
  • value (optional) is the default value of the checkbox. If exist the checkbox will be checked by default.
  • description (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the label.
  • class (optional) is a CSS class name for the HTML form field. If omitted this will default to 'inputbox'.

Example XML parameter definition:

<field name="mycheckbox" type="checkbox" label="Show title" description="" value="1" />


Example

<field 
        name="kitchen_distribution_option_1"
        id="kitchen-distribution-option_1"
        type="checkbox"
        label="COM_COTIZACION_KITCHEN_DISTRIBUTION_OPTION_1_LABEL" 
        description="COM_COTIZACION_KITCHEN_DISTRIBUTION_OPTION_1_DESC"
        value="1"
/>


See also