Brimbox Logo Brimbox Version 2.3.4 Released


Method to validate an input string against a dropdown in the dropdown array. Currently used in bulk loading data routines.

Class: bb_main, called as $main

File: bb_main.php (php)


function validate_dropdown(&$field, $dropdown, $error = false)


$test = $main->validate_dropdown($field, $dropdown);

Returns: Error message string or boolean true on error, false on successful validation.

Note: This function is case insensitive for the test but returns the value held in $dropdowns if match is not exact.

Parameter: $field (string)
Field to be validated, passed as a value so it can be changed and validated at the same time. Could be either delimited string for multiselect or simple string for normal.

Parameter: $dropdown (array)
$dropdown must already be reduced by $row_type and $col_type but should contain the string flags such as the multiselect flag. Will be reduced to integer keys within the function.

Parameter: $error(boolean)
If $error is true, will return the error message string on error. If $error is false, will return true on error. Method always returns false on successful validation.

Updated 2.0

Updated: 2016-06-16