Metainformationen zur Seite

LoxBerry::Web::mslist_select_html

$html = mslist_select_html( %params );

 

Returns ready HTML code for a Miniserver dropdown list. You can pre-select the current configured Miniserver from a config file.

LoxBerry Compatibility

This function is available starting with LoxBerry V1.2.4. If you use that function, set this minimum version in your plugin.cfg.

The function returns a string with HTML code to show a user dropdown to select a Miniserver. With parameters, you can control the label and the visuals, and you can provide the current configured Miniserver number to be pre-selected.

To give parameters to the function, use named parameters.

Parameter

Case sensitivity

All parameter names are case-sensitive and written in capital letters.

ParameterOptionalUsage
LABEL x By default, LoxBerry uses no label for the dropdown.

To use a preceding label, use the LABEL parameter.
FORMID x This is the name and id of the form element. This name is used on submitting a form, or reading the value with JavaScript.

Default is "select_miniserver".
SELECTED x Send the Miniserver number that should be pre-selected (e.g. from a config file).

The function defaults to "1", if the number you've provided does not exist, or you haven't used the parameter.
DATA_MINIx By default, the function uses the jQuery Mobile tag data-mini="true". To have the full-sized button, send DATA_MINI ⇒ "0".

Return value

Returns a string that is the HTML code for the Miniserver dropdown. Simply print the result of the function to your webpage, or send it to your HTML::Template.

If the user has no Miniservers defined, the HTML does not contain a select list, but a string that no Miniservers are defined.

Usage

use LoxBerry::Web;
my $mshtml = mslist_select_html( FORMID => 'msno', SELECTED => 2, DATA_MINI => 0 );
 
# If a HTML::Template object is used, send the html to the template
$maintemplate->param('MSHTML', $mshtml);