Difference between revisions of "Usergroup form field type"

From Joomla! Documentation

m (Added "multiple" field for multi-select)
m (Fix syntax error and add highlighting)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The '''usergroup''' form field type provides a modal select box of user groups.
+
<noinclude><languages /></noinclude>
 +
<translate><!--T:1-->
 +
The '''usergroup''' form field type provides a dropdown select box of user groups.</translate>
  
* '''type''' (mandatory) must be ''usergroup''.
+
<translate><!--T:2-->
* '''name''' (mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the ''value_field'' attribute.
+
* '''type''' (mandatory) must be ''usergroup''.</translate>
* '''label''' (mandatory) (translatable) is the descriptive title of the field.
+
<translate><!--T:3-->
* '''description''' (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
+
* '''name''' (mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the ''value_field'' attribute.</translate>
* '''class''' (optional) is a CSS class name for the HTML form field.
+
<translate><!--T:4-->
* '''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.
+
* '''label''' (mandatory) (translatable) is the descriptive title of the field.</translate>
* '''multiple''' (optional) If set to ''multiple'' then allows more than one usergroup to be selected.
+
<translate><!--T:5-->
 +
* '''description''' (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.</translate>
 +
<translate><!--T:6-->
 +
* '''class''' (optional) is a CSS class name for the HTML form field.</translate>
 +
<translate><!--T:7-->
 +
* '''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.</translate>
 +
<translate><!--T:8-->
 +
* '''multiple''' (optional) If set to ''multiple'' then allows more than one usergroup to be selected.</translate>
  
Implemented by: libraries/joomla/form/fields/usergroup.php
+
<translate><!--T:9-->
 +
Implemented by:</translate> <tt>libraries/joomla/form/fields/usergroup.php</tt>
  
Example user form field definition:
+
<translate><!--T:10-->
<source type="php">
+
Example usergroup form field definition:</translate>
 +
 
 +
<source lang="xml">
 
<field name="guest_usergroup" type="usergroup"
 
<field name="guest_usergroup" type="usergroup"
 
label="COM_USERS_CONFIG_FIELD_GUEST_USER_GROUP_LABEL"
 
label="COM_USERS_CONFIG_FIELD_GUEST_USER_GROUP_LABEL"
description="COM_USERS_CONFIG_FIELD_GUEST_USER_GROUP_DESC">
+
description="COM_USERS_CONFIG_FIELD_GUEST_USER_GROUP_DESC"  
default="1" />
+
multiple="true" />
 
</source>
 
</source>
 +
 +
<translate>=== See also === <!--T:11--></translate>
 +
<translate><!--T:12-->
 +
* [[S:MyLanguage/Standard form field types|List of standard form field types]]</translate>
  
 
<noinclude>
 
<noinclude>
=== See also ===
+
<translate>
* [[Standard form field types|List of standard form field types]]
+
<!--T:13-->
[[Category:Standard form field types]] </noinclude>
+
[[Category:Standard form field types]]
 +
</translate>
 +
</noinclude>

Latest revision as of 09:18, 27 May 2019

Other languages:
Deutsch • ‎English • ‎Nederlands • ‎español • ‎français

The usergroup form field type provides a dropdown select box of user groups.

  • type (mandatory) must be usergroup.
  • name (mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the value_field attribute.
  • label (mandatory) (translatable) is the descriptive title of the field.
  • 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.
  • 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.
  • multiple (optional) If set to multiple then allows more than one usergroup to be selected.

Implemented by: libraries/joomla/form/fields/usergroup.php

Example usergroup form field definition:

<field name="guest_usergroup" type="usergroup"
	label="COM_USERS_CONFIG_FIELD_GUEST_USER_GROUP_LABEL"
	description="COM_USERS_CONFIG_FIELD_GUEST_USER_GROUP_DESC" 
	multiple="true" />

See also[edit]