Input Element Type
PHP Database Form supports common form input types including
- text (default input type)
- textarea
- select
- autocomplete
- checkbox
- password
- radio
- checkbox (single checkbox .e.g true | false)
- checkboxlist
- wysiwyg
“select”, “autocomplete”, “radio”, “checkboxlist” all have a third parameter that can be either a list of key value pairs delimited by semicolon “;”, or a SQL SELECT.
“checkbox” also has a third parameter but with only a single key value pair. The default input type is always “text”.
Hint: add “:;” (colon semicolon) to the front of the the key value pairs to add a blank option. Do not include a trailing semicolon.
$dbForm -> set_label("EmployeeID", "Employee ID");
$dbForm -> set_label("LastName", "Last Name");
$dbForm -> set_label("FirstName", "First Name");
$dbForm -> set_label("BirthDay", "DOB");
$dbForm -> set_hide("Extension");
$dbForm -> set_hide("hireDate");
$dbForm -> set_placeholder('Title', 'official job title');
$dbForm -> add_group_header("EmployeeID", "Basic Info");
$dbForm -> add_group_header("Email", "Contact Info");
$dbForm -> add_tooltip("BirthDate", "Enter employee birth date"); // tooltip supports HTML as well
$dbForm -> set_readonly(array('EmployeeID, LastName'));
$dbForm -> set_ctrltype('Notes', 'wysiwyg');
$dbForm -> set_ctrltype("Country", "autocomplete", "SELECT Code, Name FROM Country");
$dbForm -> set_ctrltype("ReportsTo", "select", "SELECT EmployeeID, LastName FROM Employees");
$dbForm -> set_ctrltype('Email', 'email');
$dbForm -> set_ctrltype('Gender', 'radio', 'M:MMM;F:FFF;Y:YYY;Z:ZZZ');
$dbForm -> set_ctrltype('IsActive', 'checkbox', '1:0'); // single key value pair only
$dbForm -> set_ctrltype('Shift', 'checkboxlist', 'Regular:Regular;Gravy Yard:Gravy Yard');
$dbForm -> set_ctrltype('SSN', 'password');
$dbForm -> display();