Difference between revisions of "Note form field type"
From Joomla! Documentation
(Marked this version for translation) |
(Added deprecation notice and link to Joomla Manual) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
<noinclude><languages /></noinclude> | <noinclude><languages /></noinclude> | ||
+ | {{Warning|This page has been superseded and is no longer maintained. Please go to [https://manual.joomla.org/docs/general-concepts/forms-fields/standard-fields/note Joomla Manual Note Field] instead}} | ||
+ | |||
<translate><!--T:1--> | <translate><!--T:1--> | ||
This form field makes it possible to create titles, texts, descriptions and even alert boxes. It also allows you to bring order in the settings for extensions, by separating them with useful titles. Or adding descriptions for certain settings (without having to rely on the tooltips). Or adding any other text you want.</translate> | This form field makes it possible to create titles, texts, descriptions and even alert boxes. It also allows you to bring order in the settings for extensions, by separating them with useful titles. Or adding descriptions for certain settings (without having to rely on the tooltips). Or adding any other text you want.</translate> | ||
<translate><!--T:2--> | <translate><!--T:2--> | ||
− | The syntax is | + | The syntax is straight-forward:</translate> |
− | < | + | <syntaxhighlight lang="php"> |
<field name="..." type="note" label="..." description="..." class="..." close="..." /> | <field name="..." type="note" label="..." description="..." class="..." close="..." /> | ||
− | </ | + | </syntaxhighlight> |
<translate> | <translate> | ||
Line 13: | Line 15: | ||
</translate> | </translate> | ||
<translate><!--T:4--> | <translate><!--T:4--> | ||
− | *''Name:'' contains the name of the field ( | + | *''Name:'' contains the name of the field (as with any other field tag)</translate> |
<translate><!--T:5--> | <translate><!--T:5--> | ||
*''Type:'' the type of the field, which is: note</translate> | *''Type:'' the type of the field, which is: note</translate> | ||
Line 23: | Line 25: | ||
*''Heading:'' the type of heading element to use for the label (optional) (default: h4)</translate> | *''Heading:'' the type of heading element to use for the label (optional) (default: h4)</translate> | ||
<translate><!--T:9--> | <translate><!--T:9--> | ||
− | *''Class:'' a class name (or class names), like alert (see | + | *''Class:'' a class name (or class names), like alert (see below for examples) (optional)</translate> |
<translate><!--T:10--> | <translate><!--T:10--> | ||
− | *''Close:'' a value of 'true' (for alerts) or the value for the data-dismiss of the | + | *''Close:'' a value of 'true' (for alerts) or the value for the data-dismiss of the Bootstrap close icon (optional)</translate> |
<translate> | <translate> | ||
− | ==Title and | + | ==Title and Description== <!--T:11--> |
</translate> | </translate> | ||
<translate><!--T:12--> | <translate><!--T:12--> | ||
In the following code examples we will use these example language strings:</translate> | In the following code examples we will use these example language strings:</translate> | ||
− | < | + | <syntaxhighlight lang="ini"> |
LOREMIPSUM="Lorem ipsum dolor sit amet" | LOREMIPSUM="Lorem ipsum dolor sit amet" | ||
LOREMIPSUM_DESC="Consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat." | LOREMIPSUM_DESC="Consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat." | ||
− | </ | + | </syntaxhighlight> |
<translate><!--T:13--> | <translate><!--T:13--> | ||
− | + | With this note field you can either use the title or the description or both.</translate> | |
− | < | + | <syntaxhighlight lang="php"> |
<field name="opt10" type="text" label="Some Other Option" /> | <field name="opt10" type="text" label="Some Other Option" /> | ||
<field name="note11" type="note" label="LOREMIPSUM" /> | <field name="note11" type="note" label="LOREMIPSUM" /> | ||
Line 48: | Line 50: | ||
<field name="note13" type="note" label="LOREMIPSUM" description="LOREMIPSUM_DESC" /> | <field name="note13" type="note" label="LOREMIPSUM" description="LOREMIPSUM_DESC" /> | ||
<field name="opt13" type="text" label="Some Other Option" /> | <field name="opt13" type="text" label="Some Other Option" /> | ||
− | </ | + | </syntaxhighlight> |
[[Image:Help25-note-form-field-title-screenshot.png]] | [[Image:Help25-note-form-field-title-screenshot.png]] | ||
Line 56: | Line 58: | ||
</translate> | </translate> | ||
<translate><!--T:15--> | <translate><!--T:15--> | ||
− | You can add classes to the note. | + | You can add classes to the note. In this way you can easily make (Bootstrap) alerts and also add other styling via class names (like a 'well').</translate> |
− | < | + | <syntaxhighlight lang="php"> |
<field name="opt20" type="text" label="Some Other Option" /> | <field name="opt20" type="text" label="Some Other Option" /> | ||
<field name="note21" type="note" class="alert" label="LOREMIPSUM" description="LOREMIPSUM_DESC" /> | <field name="note21" type="note" class="alert" label="LOREMIPSUM" description="LOREMIPSUM_DESC" /> | ||
Line 68: | Line 70: | ||
<field name="note24" type="note" class="alert alert-error" label="LOREMIPSUM" description="LOREMIPSUM_DESC" /> | <field name="note24" type="note" class="alert alert-error" label="LOREMIPSUM" description="LOREMIPSUM_DESC" /> | ||
<field name="opt24" type="text" label="Some Other Option" /> | <field name="opt24" type="text" label="Some Other Option" /> | ||
− | </ | + | </syntaxhighlight> |
[[Image:Help25-note-form-field-classes-screenshot.png]] | [[Image:Help25-note-form-field-classes-screenshot.png]] | ||
<translate> | <translate> | ||
− | ==Close | + | ==Close Button== <!--T:16--> |
</translate> | </translate> | ||
<translate><!--T:17--> | <translate><!--T:17--> | ||
− | A close button can be added to the alerts by adding the close="true" attribute to the tag. If you use a | + | A close button can be added to the alerts by adding the ''close="true"'' attribute to the tag. If you use a class other than the alert, use the required value for the data-dismiss of the Bootstrap close icon instead of the value ''true''. Here is the code to test the close icon on an alert.</translate> |
− | < | + | <syntaxhighlight lang="php"> |
<field name="opt30" type="text" label="Some Other Option" /> | <field name="opt30" type="text" label="Some Other Option" /> | ||
<field name="note31" type="note" class="alert" close="true" label="LOREMIPSUM" description="LOREMIPSUM_DESC" /> | <field name="note31" type="note" class="alert" close="true" label="LOREMIPSUM" description="LOREMIPSUM_DESC" /> | ||
<field name="opt31" type="text" label="Some Other Option" /> | <field name="opt31" type="text" label="Some Other Option" /> | ||
− | </ | + | </syntaxhighlight> |
[[Image:Help25-note-form-field-close-screenshot.png]] | [[Image:Help25-note-form-field-close-screenshot.png]] | ||
Line 92: | Line 94: | ||
<translate> | <translate> | ||
− | == See | + | == See Also == <!--T:18--> |
</translate> | </translate> | ||
<translate><!--T:19--> | <translate><!--T:19--> |
Latest revision as of 21:20, 15 July 2024
This page has been superseded and is no longer maintained. Please go to Joomla Manual Note Field instead
This form field makes it possible to create titles, texts, descriptions and even alert boxes. It also allows you to bring order in the settings for extensions, by separating them with useful titles. Or adding descriptions for certain settings (without having to rely on the tooltips). Or adding any other text you want.
The syntax is straight-forward:
<field name="..." type="note" label="..." description="..." class="..." close="..." />
Attributes[edit]
- Name: contains the name of the field (as with any other field tag)
- Type: the type of the field, which is: note
- Label: the title of the note (uses JText) (optional if using description)
- Description: the description/text of the note (uses JText) (optional if using label)
- Heading: the type of heading element to use for the label (optional) (default: h4)
- Class: a class name (or class names), like alert (see below for examples) (optional)
- Close: a value of 'true' (for alerts) or the value for the data-dismiss of the Bootstrap close icon (optional)
Title and Description[edit]
In the following code examples we will use these example language strings:
LOREMIPSUM="Lorem ipsum dolor sit amet"
LOREMIPSUM_DESC="Consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."
With this note field you can either use the title or the description or both.
<field name="opt10" type="text" label="Some Other Option" />
<field name="note11" type="note" label="LOREMIPSUM" />
<field name="opt11" type="text" label="Some Other Option" />
<field name="note12" type="note" description="LOREMIPSUM_DESC" />
<field name="opt12" type="text" label="Some Other Option" />
<field name="note13" type="note" label="LOREMIPSUM" description="LOREMIPSUM_DESC" />
<field name="opt13" type="text" label="Some Other Option" />
Classes (Alerts)[edit]
You can add classes to the note. In this way you can easily make (Bootstrap) alerts and also add other styling via class names (like a 'well').
<field name="opt20" type="text" label="Some Other Option" />
<field name="note21" type="note" class="alert" label="LOREMIPSUM" description="LOREMIPSUM_DESC" />
<field name="opt21" type="text" label="Some Other Option" />
<field name="note22" type="note" class="alert alert-info" label="LOREMIPSUM" description="LOREMIPSUM_DESC" />
<field name="opt22" type="text" label="Some Other Option" />
<field name="note23" type="note" class="alert alert-success" label="LOREMIPSUM" description="LOREMIPSUM_DESC" />
<field name="opt23" type="text" label="Some Other Option" />
<field name="note24" type="note" class="alert alert-error" label="LOREMIPSUM" description="LOREMIPSUM_DESC" />
<field name="opt24" type="text" label="Some Other Option" />
Close Button[edit]
A close button can be added to the alerts by adding the close="true" attribute to the tag. If you use a class other than the alert, use the required value for the data-dismiss of the Bootstrap close icon instead of the value true. Here is the code to test the close icon on an alert.
<field name="opt30" type="text" label="Some Other Option" />
<field name="note31" type="note" class="alert" close="true" label="LOREMIPSUM" description="LOREMIPSUM_DESC" />
<field name="opt31" type="text" label="Some Other Option" />
Be aware that a closed alert/note cannot be reopened by the user without page reload. It's not a show/hide functionality.