defineAllowableValues
In addition, you can use the third parameter (optional) to allow fields (after being inserted) to NOT have only the allowed values permissable. If set to TRUE then a regular textbox will appear when editing this field--allowing any values.
Details
Type | function |
---|---|
Returns | void |
Parameters
- fieldName
- The database field name to define allowable values for
- validValues
- The allowed values for that field. Can be an array of strings (for value = text) or an array of arrays (where [0] = value and [1] = text)
- (optional) onedit_textbox (default: false)
- If set to true this value allows the field to not open a dropdown box on EDIT of the field. It will be a textbox allowing any input
Example
With id and value the same
$valid_values = array("DropdownValue 1", "Dropdown Value2");
$tblDemo->defineAllowableValues("fldCertainFields", $valid_values);
With id and value different
$valid_values = array( array(0 => "ddv1", 1 => "Dropdown Value 1"),
array(0 => "ddv2", 1 => "Dropdown Value2") );
$tblDemo->defineAllowableValues("fldCertainFields", $valid_values);