Textpattern PHP Cross Reference Content Management Systems

Summary: /textpattern/lib/txplib_forms.php - 792 lines - 22695 bytes - Source - Print

Description: Collection of HTML form widgets.

Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 21 functions

radioSet()
yesnoRadio()
onoffRadio()
selectInput()
treeSelectInput()
timezoneSelectInput()
fInput()
hInput()
sInput()
eInput()
tInput()
checkbox()
checkbox2()
radio()
form()
fetch_editable()
text_area()
type_select()
type_options()
radio_list()
tsi()

Functions

Functions that are not part of a class:

radioSet($values, $field, $checked = '', $tabindex = 0, $id = '')  line: 30
Generates a radio button toggle.

return: string A HTML radio button set
param: array  $values   The values as an array
param: string $field    The field name
param: string $checked  The checked button, takes a value from $vals
param: int    $tabindex The HTML tabindex
param: string $id       The HTML id
yesnoRadio($field, $checked = '', $tabindex = 0, $id = '')  line: 64
Generates a Yes/No radio button toggle.

These buttons are booleans. 'Yes' will have a value of 1 and 'No' is 0.

return: string HTML
param: string $field    The field name
param: string $checked  The checked button, either '1', '0'
param: int    $tabindex The HTML tabindex
param: string $id       The HTML id
onoffRadio($field, $checked = '', $tabindex = 0, $id = '')  line: 92
Generates an On/Off radio button toggle.

return: string HTML
param: string $field    The field name
param: string $checked  The checked button, either '1', '0'
param: int    $tabindex The HTML tabindex
param: string $id       The HTML id
selectInput($name = '', $array = array()  line: 113
Generates a select field.

return: string HTML
param: string $name        The field
param: array  $array       The values as an array array( 'value' => 'label' )
param: mixed  $value       The selected option(s). If an array, renders the select multiple
param: bool   $blank_first If TRUE, prepends an empty option to the list
param: mixed  $onchange    If TRUE submits the form when an option is changed. If a string, inserts it to the select tag
param: string $select_id   The HTML id
param: bool   $check_type  Type-agnostic comparison
param: bool   $disabled    If TRUE renders the select disabled
treeSelectInput($select_name = '', $array = array()  line: 193
Generates a tree structured select field.

This field takes a NSTREE structure as an associative array. This is mainly
used for categories.

return: string HTML
param: string $select_name The field
param: array  $array       The values as an array
param: string $value       The selected option. Takes a value from $value
param: string $select_id   The HTML id
param: int    $truncate    Truncate labels to certain length. Disabled if set <4.
timezoneSelectInput($name = '', $value = '', $blank_first = '', $onchange = '', $select_id = '')  line: 253
Render HTML &lt;select&gt; element for choosing a timezone.

return: string HTML markup
param: string      $name        Element name
param: string      $value       Selected timezone
param: bool        $blank_first Add empty first option
param: bool|string $onchange
param: string      $select_id   HTML id attribute
fInput($type, $name, $value, $class = '', $title = '', $onClick = '', $size = 0, $tab = 0, $id = '', $disabled = false, $required = false, $placeholder = null)  line: 308
Generic form input.

return: string HTML input
param: string       $type         The input type
param: string       $name         The input name
param: string       $value        The value
param: string       $class        The HTML class
param: string       $title        The tooltip
param: string       $onClick      Inline JavaScript attached to the click event
param: int          $size         The input size
param: int          $tab          The HTML tabindex
param: string       $id           The HTML id
param: bool         $disabled     If TRUE renders the input disabled
param: bool         $required     If TRUE the field is marked as required
param: string       $placeholder  The placeholder value displayed when the field is empty
hInput($name, $value = null, $glue = ',')  line: 358
Hidden form input.

return: string       HTML input
param: string/array $name  The name
param: string       $value The value
sInput($step line: 379
Hidden step input.

return: string HTML input
param: string $step The step
eInput($event line: 398
Hidden event input.

return: string HTML input
param: string $event The event
tInput()  line: 417
Hidden form token input.

return: string A hidden HTML input containing a CSRF token
checkbox($name, $value, $checked = true, $tabindex = 0, $id = '')  line: 430
A checkbox.

return: string HTML input
param: string $name     The field
param: string $value    The value
param: bool   $checked  If TRUE the box is checked
param: int    $tabindex The HTML tabindex
param: string $id       The HTML id
checkbox2($name, $value, $tabindex = 0, $id = '')  line: 465
A checkbox without an option to set the value.

return: string HTML input
param: string $name     The field
param: bool   $value    If TRUE the box is checked
param: int    $tabindex The HTML tabindex
param: string $id       The HTML id
radio($name, $value, $checked = true, $id = '', $tabindex = 0)  line: 482
A single radio button.

return: string HTML input
param: string $name     The field
param: string $value    The value
param: bool   $checked  If TRUE, the button is selected
param: string $id       The HTML id
param: int    $tabindex The HTML tabindex
form($contents, $style = '', $onsubmit = '', $method = 'post', $class = '', $fragment = '', $id = '', $role = '', $allow_autocomplete = true)  line: 515
Generates a form element.

This form will contain a CSRF token if called on an authenticated page.

return: string HTML form element
param: string $contents           The form contents
param: string $style              Inline styles added to the form
param: string $onsubmit           JavaScript run when the form is sent
param: string $method             The form method, e.g. "post", "get"
param: string $class              The HTML class
param: string $fragment           A URL fragment added to the form target
param: string $id                 The HTML id
param: string $role               ARIA role name
param: bool   $allow_autocomplete If FALSE, the form is set to autocomplete="off"
fetch_editable($name, $event, $identifier, $id line: 561
Gets and sanitises a field from a prefixed core database table.

return: string HTML
param: string $name       The field
param: string $event      The table
param: string $identifier The field used for selecting
param: string $id         The value used for selecting
text_area($name, $h = 0, $w = 0, $thing = '', $id = '', $rows = 5, $cols = 40, $placeholder = null, $required = false)  line: 581
A textarea.

return: string HTML
param: string $name        The field
param: int    $h           The field height in pixels
param: int    $w           The field width in pixels
param: string $thing       The value
param: string $id          The HTML id
param: int    $rows        Rows
param: int    $cols        Columns
param: string $placeholder The placeholder value displayed when the field is empty
param: bool   $required    If TRUE the field is marked as required
type_select($options line: 638
Generates a select field with a name "type".

return: string
param: array $options
type_options($array line: 652
Generates a list of options for use in a select field.

return: string
param: array $array
radio_list($name, $values, $current_val = '', $hilight_val = '', $atts = array('class' => 'plain-list')  line: 670
Generates a list of radio buttons wrapped in an unordered list.

return: string       HTML
param: string       $name        The field
param: array        $values      The values as an array array( $value => $label )
param: string       $current_val The selected option. Takes a value from $value
param: string       $hilight_val The highlighted list item
param: string|array $atts        HTML attributes
tsi($name, $datevar, $time, $tab = 0, $id = '')  line: 703
Generates a field used to store and set a date.

return: string HTML
param: string $name        The field
param: string $datevar     The strftime format the date is displayed
param: int    $time        The displayed date as a UNIX timestamp
param: int    $tab         The HTML tabindex
param: string $id          The HTML id

title

Body