mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Added optional $event param to SelectorOptions()
This commit is contained in:
parent
bbe430028c
commit
6d7aa1b401
@ -142,19 +142,21 @@ function isAssoc($arr)
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Display a selector field for a form. Arguments are:
|
* Display a selector field for a form. Arguments are:
|
||||||
* $name: Field name
|
* @param string $name: Field name
|
||||||
* $options: Array of options
|
* @param array $options: Array of options
|
||||||
* $selected: Selected option (optional)
|
* @param string $selected: Selected option (optional)
|
||||||
* If $options is an associative array this should be the key
|
* @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).'"';
|
echo '<select class="form-control" name="'.htmlspecialchars($name, ENT_QUOTES).'"';
|
||||||
if (isset($id)) {
|
if (isset($id)) {
|
||||||
echo ' id="' . htmlspecialchars($id, ENT_QUOTES) .'"';
|
echo ' id="' . htmlspecialchars($id, ENT_QUOTES) .'"';
|
||||||
}
|
}
|
||||||
|
if (isset($event)) {
|
||||||
|
echo ' onChange="' . htmlspecialchars($event, ENT_QUOTES).'()"';
|
||||||
|
}
|
||||||
echo '>' , PHP_EOL;
|
echo '>' , PHP_EOL;
|
||||||
foreach ($options as $opt => $label) {
|
foreach ($options as $opt => $label) {
|
||||||
$select = '';
|
$select = '';
|
||||||
|
Loading…
Reference in New Issue
Block a user