Form field

From Joomla! Documentation

Revision as of 07:41, 7 June 2011 by Mvangeest (talk | contribs) (Added link)

Form fields are fields in a HTML <form>. Joomla! 1.6 Joomla 1.6 and newer supply the JForm class to conveniently and flexibly create forms with a large amount of form fields. Each form field type is a subclass of JFormField.

In addition to being a flexible page creation tool, JFormFields are used by Joomla! to allow administrators to configure Joomla! or its extensions without changing the underlying code. In Joomla! 1.5, this was handled by the now deprecated JParameter and JElement classes.

To define form fields in the configuration of an extension, you must include them into the <fields name="params"> section of the <config> element in your XML manifest file.

Standard form field types[edit]

<translate> Numerous types of form field are built into Joomla!. The following table lists these standard types and their availability. Use the single-page reference if you want to print all existing form field documentation.</translate>

<translate> Joomla 1.5 Please note that many of these fields are available as parameter types in Joomla! 1.5. For a list of parameter types, see J1.5:Standard parameter types. For a comparison between form field and parameter types, see Standard form field and parameter types.</translate>

<translate>

Type</translate>

<translate>

Description</translate>

<translate>

Availability</translate>

<translate>

accessiblemedia</translate>

<translate>

provides modal access to the media manager for insertion of images with upload for users with appropriate permissions and a text field for adding a alternative text.</translate>

Joomla 4.0 <translate>

and newer</translate>

<translate>

accesslevel</translate>

<translate>

provides a drop down list of viewing access levels.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

cachehandler</translate>

<translate>

provides a list of available cache handling options.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

calendar</translate>

<translate>

provides a text box for entry of a date. An icon next to the text box provides a link to a pop-up calendar, which can also be used to enter the date value.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

captcha</translate>

<translate>

provides the use of a captcha plugin.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

category</translate>

<translate>

provides a drop down list of categories for an extension.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

checkbox</translate>

<translate>

provides a single checkbox to be checked or unchecked</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

checkboxes</translate>

<translate>

provides unlimited checkboxes that can be used for multi-select.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

Chrome Style</translate>

<translate>

provides a list of template chrome style options grouped by template.</translate>

Joomla 3.0 <translate>

and newer</translate>

<translate>

color</translate>

<translate>

provides a color picker when clicking the input box.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

Content Language</translate>

<translate>

Provides a list of content languages.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

Content Type</translate>

<translate>

Provides a list of content types.</translate>

Joomla 3.1 <translate>

and newer</translate>

<translate>

combo</translate>

<translate>

provides a combo box field.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

componentlayout</translate>

<translate>

provides a grouped list of core and template alternative layouts for a component item.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

contentlanguage</translate>

<translate>

provides a list of installed content languages for use in conjunction with the language switcher plugin.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

Database Connection</translate>

<translate>

Provides a list of available database connections, optionally limiting to a given list.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

editor</translate>

<translate>

provides an editor area field.</translate>

Joomla 1.6 <translate>

and newer</translate>

<translate>

editors</translate>

<translate>

Provides a drop down list of the available WYSIWYG editors. Since Joomla 2.5 use plugins form field instead.</translate>

Joomla 1.6
<translate>

email</translate>

<translate>

provides an email field.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

file</translate>

<translate>

Provides an input field for files</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

filelist</translate>

<translate>

provides a drop down list of files from a specified directory.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

folderlist</translate>

<translate>

provides a drop down list of folders from a specified directory.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

groupedlist</translate>

<translate>

provides a drop down list of items organized into groups.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

header tag</translate>

<translate>

provides a drop down list of the header tags (h1-h6)</translate>.

Joomla 3.0 <translate>

and newer</translate>

<translate>

helpsite</translate>

<translate>

provides a drop down list of the help sites for your Joomla installation.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

hidden</translate>

<translate>

provides a hidden field for saving a form field whose value cannot be altered directly by a user in the Administrator (it can be altered in code or by editing the params.ini file).</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

imagelist</translate>

<translate>

provides a drop down list of image files in a specified directory.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

integer</translate>

<translate>

provides a drop down list of integers between a minimum and maximum.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

language</translate>

<translate>

provides a drop down list of the installed languages for the Front-end or Back-end.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

list</translate>

<translate>

provides a drop down list of custom-defined entries.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

media</translate>

<translate>

provides modal access to the media manager for insertion of images with upload for users with appropriate permissions.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

menu</translate>

<translate>

provides a drop down list of the available menus from your Joomla site.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

Menu Item</translate>

<translate>

provides a drop down list of the available menu items from your Joomla site.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate> meter</translate> <translate>

Provides a meter to show value in a range.</translate>

Joomla 3.2 <translate>

and newer</translate>

<translate>

Module Layout</translate>

<translate>

provides a list of alternative layout for a module grouped by core and template.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

Module Order</translate>

<translate>

Provides a drop down to set the ordering of module in a given position</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

Module Position</translate>

<translate>

provides a text input to set the position of a module.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

Module Tag</translate>

<translate>

provides a list of html5 elements (used to wrap a module in).</translate>

Joomla 3.0 <translate>

and newer</translate>

<translate>

note</translate>

<translate>

supports a one line text field.</translate>

Joomla 3.1 <translate>

and newer</translate>

<translate>

number</translate>

<translate>

Provides a one line text box with up-down handles to set a number in the field.</translate>

Joomla 3.2 <translate>

and newer</translate>

<translate>

password</translate>

<translate>

provides a text box for entry of a password. The password characters will be obscured as they are entered.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

plugins</translate>

<translate>

provides a list of plugins from a given folder.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

predefinedlist</translate>

<translate>

Form Field to load a list of predefined values.</translate>

Joomla 3.2 <translate>

and newer</translate>

<translate>

radio</translate>

<translate>

provides radio buttons to select different options.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

range</translate>

<translate>

Provides a horizontal scroll bar to specify a value in a range.</translate>

Joomla 3.2 <translate>

and newer</translate>

<translate>

repeatable</translate>

<translate>

Allows form fields which can have as many options as the user desires.</translate>

Joomla 3.2 <translate>

and newer</translate>

<translate>

rules</translate>

<translate>

provides a matrix of group by action options for managing access control. Display depends on context.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

sessionhandler</translate>

<translate>

provides a drop down list of session handler options.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

spacer</translate>

<translate>

provides a visual separator between form fields. It is purely a visual aid and no value is stored.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

sql</translate>

<translate>

provides a drop down list of entries obtained by running a query on the Joomla Database. The first results column returned by the query provides the values for the drop down box.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

subform</translate>

<translate>

provides a way to use XML forms inside each other or reuse your existing forms inside your current form.</translate>

Joomla 3.6 <translate>

and newer</translate>

<translate>

tag</translate>

<translate>

provides an entry point for tags (either AJAX or Nested).</translate>

Joomla 3.1 <translate>

and newer</translate>

<translate>

tel</translate>

<translate>

provides an input field for a telephone number.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

templatestyle</translate>

<translate>

provides a drop down list of template styles.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

text</translate>

<translate>

provides a text box for data entry.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

textarea</translate>

<translate>

provides a text area for entry of multi-line text.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

timezone</translate>

<translate>

provides a drop down list of time zones.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

URL</translate>

<translate>

provides a URL text input field.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

user</translate>

<translate>

Field to select a user from a modal list. Displays User Name and stores User ID</translate>

Joomla 1.6 <translate>

and newer</translate>

<translate> useractive</translate> <translate>

Field to show a list of available user active statuses.</translate>

Joomla 3.2 <translate>

and newer</translate>

<translate>

usergroup</translate>

<translate>

provides a drop down list of user groups. Since Joomla 3.2 use usergrouplist instead.</translate>

Joomla 2.5 <translate>

and newer</translate>

<translate>

usergrouplist</translate>

<translate>

Field to load a drop down list of available user groups. Replaces usergroup form field type.</translate>

Joomla 3.2 <translate>

and newer</translate>

<translate> userstate</translate> <translate>

Field to load a list of available users statuses.</translate>

Joomla 3.2 <translate>

and newer</translate>


Custom form field types[edit]

An extension can define its own form field types, which can then be used in its own forms or forms created by another extension. See Creating a custom form field type for instructions.