mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-21 23:20:22 +00:00
Added optional $event param to SelectorOptions()
This commit is contained in:
parent
bbe430028c
commit
6d7aa1b401
1 changed files with 9 additions and 7 deletions
|
@ -142,19 +142,21 @@ function isAssoc($arr)
|
|||
/**
|
||||
*
|
||||
* Display a selector field for a form. Arguments are:
|
||||
* $name: Field name
|
||||
* $options: Array of options
|
||||
* $selected: Selected option (optional)
|
||||
* If $options is an associative array this should be the key
|
||||
*
|
||||
* @param string $name: Field name
|
||||
* @param array $options: Array of options
|
||||
* @param string $selected: Selected option (optional)
|
||||
* @param string $id: $options is an associative array this should be the key
|
||||
* @param string $event: onChange event (optional)
|
||||
*/
|
||||
function SelectorOptions($name, $options, $selected = null, $id = null)
|
||||
function SelectorOptions($name, $options, $selected = null, $id = null, $event = null)
|
||||
{
|
||||
echo '<select class="form-control" name="'.htmlspecialchars($name, ENT_QUOTES).'"';
|
||||
if (isset($id)) {
|
||||
echo ' id="' . htmlspecialchars($id, ENT_QUOTES) .'"';
|
||||
}
|
||||
|
||||
if (isset($event)) {
|
||||
echo ' onChange="' . htmlspecialchars($event, ENT_QUOTES).'()"';
|
||||
}
|
||||
echo '>' , PHP_EOL;
|
||||
foreach ($options as $opt => $label) {
|
||||
$select = '';
|
||||
|
|
Loading…
Reference in a new issue