FORM elements

Use for building form elements and jQuery widgets.
Common parameters to all functions:

  1. string $name
    defines HTML element name, if prefixed with # character, id attribute is auto created
  2. array $attributes
    php array (name => value pairs) for HTML element attributes or widget options (prefix with "data-")
    data-widget attribute name defines jQuery widget class name, widgets can be chained, use space for name separation (data-widget="multislect multiselectfilter")
    main widget option names can have prefix or not ("data-<option>" or "data-<widget>-<option>")
    chained slave widgets options must have prefix ("data-<widget>-<option>")
    how to build attribute names with data prefix and value type conversion see jQuery ("data-last-value" => "lastValue")
    if data attribute value begins with "function", anonymous function is created and assigned to attribute ("data-before-load" => "function() { alert ('Loading.'); }")

string form::hidden (string $name, string $value = null, array $attributes = array())

Builds HTML hidden input element.
<?php
// Outputs: <input type="hidden" name="actionID" value="save");
echo form::hidden ("actionID", "save");

// Outputs: <input type="hidden" name="actionID" id="actionID" value="save");
echo form::hidden ("#actionID", "save");
?>

string password (string $name, string $value = null, array $attributes = array())

Builds HTML password input element.

string select (string $name, mixed $value = null, array $options = array(), array $attributes = array())

Builds HTML select input element. Options can be grouped. Parameter $value can be string (single select or dropdown) or array type (multi select).

string selectMulti (string $name, mixed $value = null, array $options = array(), array $attributes = array())

Builds jQuery multi select dropdown widget. In dropdown is included filtering, user can select one or more options.
For list of options see authors page.

string selectFilter (string $name, string $select, array $attributes = array())

Builds HTML text input element with $name and binds it to HTML select element. $select can be select element id or any jQuery selector. $attributes are HTML text input element attributes and/or filtering options.
data-filtergroup => false: default; apply filter on select options
data-filtergroup => true: apply filter on select group options (all options of filtered groups are displayed)
<?php
  // creates and binds text input with id "countryFilter" to select with id "countries"
  echo form::selectFilter("#countryFilter", "#countries").
       form::select("#countries", $selectedCountry, $countriesOpt, array ("size" => 40));
?>

string text (string $name, string $value = null, array $attributes = array())

Builds HTML text input element.







sss

© 2003-24 iNeta d.o.o. | Koroška cesta 31, SI-4000 Kranj | info@ineta.si | Pravno obvestilo
Powered by BravoCMS