Skip to content

Commit

Permalink
Select - fix selected for multiple (again), correct order in js
Browse files Browse the repository at this point in the history
  • Loading branch information
SjonHortensius committed Mar 22, 2015
1 parent 6a51614 commit a8a4a7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion usr/local/www/classes/Form/Select.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ protected function _getInput()
$options = '';
foreach ($this->_values as $value => $name)
{
$selected = (is_array($this->_value) && array_key_exists($value, $this->_value) || $this->_value == $value);
if (isset($this->_attributes['multiple']))
$selected = in_array($value, (array)$this->_value);
else
$selected = ($this->_value == $value);

$options .= '<option value="'. htmlspecialchars($value) .'"'.($selected ? ' selected' : '').'>'. gettext($name) .'</option>';
}

Expand Down
12 changes: 6 additions & 6 deletions usr/local/www/jquery/pfSense.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
*/

$(function() {
// Enable popovers globally
$('[data-toggle="popover"]').popover()

runEvents();
bindCollapseToOptions();

/**
* Run in-page defined events
*/
Expand Down Expand Up @@ -43,4 +37,10 @@ $(function() {
// Trigger change to open currently selected item
selects.trigger('change');
};

// Enable popovers globally
$('[data-toggle="popover"]').popover()

runEvents();
bindCollapseToOptions();
});

0 comments on commit a8a4a7e

Please sign in to comment.