![]() |
Languages: |
English |
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.
Example XML field definition:
<field name="show_title" type="checkbox" label="Show title" description="Show the title of the item" value="1" />
Example XML field definition (unchecked):
<field name="show_title" type="checkbox" label="Show title" description="Show the title of the item" value="1" default="0" />
Special care needs to be taken with saving a checkbox from a form!! This is a common mistake.
You see, on saving a form with a checkbox that is unchecked, there is no variable for it in the POST information and joomla does not take care of that yet!
See Discussion on this page for more.