Brimbox Logo Brimbox Version 2.3.4 Released

render>>

Method to render a form variable, this method will format a value according to a validation function if valid. Method has a waterfall; first it uses the default value, then if state is set it overwrites that value with state value, and finally if $POST variable for the form variable is set it uses that value. Form variable and state array associative key must have the same name. Finally the value is validated and $check is either set false for valid, true or error message string for invalid. Value will be rendered if valid and validation function facilitates formatting.

Class: bb_work, called as $main

File: bb_work.php (php)

Declaration:

function render($name, $module, &$arr_state, $type, &$check, $default = "", $error = false)

Usage:

$value = $main->render($name, $module, $arr_state, $type, $check, $default, $error);

global $POST
global $array_validation

Returns: final value from method waterfall (which is default, state, then postback) formatted by validation function and cast as string.

Note: $arr_state passed as a value and updated, $value will be formatted according to its validation type if validated.

Note: $check passed as a value and created if not set, $check will be true or error message string depending on $error flag, false if validated.

Parameter: $name (string)
Name of the associative array key and form variable, must be the same.

Parameter: $module (string)
Module to check for $POST variable, usually the current module.

Parameter: $arr_state (array)
Passed by reference, state array to be referenced and updated during processing.

Parameter: $type (string)
Data type from $array_validation, the validate functions will format the working value.

Parameter: $check (mixed)
Passed by reference, will be set to false on successful validation, true or error message string if not validated.

Parameter: $default (optional string)
Value to be returned and saved in state array if state and $POST variable not set.

Parameter: $error (boolean)
Whether to return error string or boolean true

Updated: 2016-07-09