Contao Open Source CMS > Enhance > Extension list > [inputcount] inputcount 1.4.2 stable

Extensions > inputcount

[inputcount] inputcount

Counts the number of characters in backend fields

Generel function

This module displays popups with information about the current character number in a text field or textarea. Additionally recommendations can be shown. Examples can be found in the page structure (/system/modules/inputcount/dca/tl_page.php).

Frontend usage

You need a unique id for the form and the field to use this extension in the frontend. For regular Contao forms this are "fX" for the form (with X = internal form number) and "ctrl_X" for fields (with X = internal field number). For extensions you might need to set ids manually. The frontend usage was added in version 1.4.0.

 

As your messages might be language dependen, please add your configuration to file system/config/langconfig.php. Here are some samples:

Field ctrl_15 in form f5 with special text:
if ($GLOBALS['TL_LANGUAGE'] == 'en')
{
  $GLOBALS['INPUTCOUNT']['f5']['ctrl_16']['message'] = "My message - Current: %s characters";
}
else
{
  $GLOBALS['INPUTCOUNT']['f5']['ctrl_16']['message'] = "Mein Text - Aktuell: %s Zeichen";
}

Field ctrl_17 in form f5 with 100 char limit, default text:
$GLOBALS['INPUTCOUNT']['f5']['ctrl_17']['maxlength'] = 100;

Field ctrl_19 in form f5 without limit and default text (this is only needed if maxlength and message are not set)
$GLOBALS['INPUTCOUNT']['f5']['ctrl_19']['on'] = true;

Backend usage

The backend usage is for developers of other extensions.

For own counters add this line to the dcaconfig.php:
$GLOBALS['TL_CONFIG']['inputcount'][] = 'tl_page.description';

This will show the current character number. If you want to display a specific text, type:
$GLOBALS['TL_LANG']['MSC']['tl_page.description'] = 'Recommended text length: 120-140 characters.Current: %s Characters;

From version 1.3.0 stable on it is possible to limit the text length of textareas. This is achieved through Javascript as HTML does not support it. A popup will tell the user to stop and clip the input.
$GLOBALS['TL_DCA']['tl_page']['fields']['description']['eval']['maxlength'] = 140;

All three examples are included in the module.

Version1.4.2 stableTypeFree
Release date2010-08-17CategoryPlugin
LicenseLGPL
Copyright© 2011 Jan Theofel, 2009 - 2010 by ETES GmbH
AuthorJan Theofel (jan.theofel) http://www.theofel.de/
Release notes and change log for 1.4.2 stableOther versions

- Added usage for select-fields. Can be used to display information for such fields.

1.0.0 stable
1.1.0 stable
1.1.1 stable
1.1.2 stable
1.1.3 stable
1.2.0 stable
1.2.1 stable
1.3.0 stable
1.3.1 stable
1.3.2 stable
1.4.0 stable
1.4.1 stable
Release downloads92Total downloads225
Release installs319Total installs1343
Release updates488Total updates868
Dependencies of this extensionOther extensions depending on this one
NameVersion fromVersion to
Contao2.6.0 stable2.10.4 stable
NameVersion fromVersion to
rm_basic_extensions1.0.0 stable1.0.0 stable
PackageSizeDate
Contao_inputcount_10040029_14.zip221652012-01-15 02:00