Skip to content

Commit

Permalink
fixed notice in date plugin.
Browse files Browse the repository at this point in the history
fixed dropdown element not showing data in details view
  • Loading branch information
pollen8 committed Oct 12, 2011
1 parent 043a4d4 commit b94c2e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion plugins/fabrik_element/date/date.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ function calendar($value, $name, $id, $format = '%Y-%m-%d', $attribs = null, $re
if (!empty($validations)) {
//if we have a validation on the element run it when the calendar closes itself
//this ensures that alert messages are removed if the new data meets validation criteria
$script .= 'form_'.$formModel->_id.'.doElementValidation(\''.$subElContainerId.'\');' . "\n";
$script .= 'form_'.$formModel->getId().'.doElementValidation(\''.$subElContainerId.'\');' . "\n";
}
$script .= "});\n"; //end onclose function

Expand Down
18 changes: 5 additions & 13 deletions plugins/fabrik_element/dropdown/dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function render($data, $repeatCounter = 0)
$arTxt = $this->getSubOptionLabels();
$multiple = $params->get('multiple', 0);
$multisize = $params->get('dropdown_multisize', 3);
$selected = $this->getValue($data, $repeatCounter);
$selected = (array)$this->getValue($data, $repeatCounter);
$errorCSS = (isset($this->_elementError) && $this->_elementError != '') ? " elementErrorHighlight" : '';
$attribs = 'class="fabrikinput inputbox'.$errorCSS."\"";

Expand All @@ -65,7 +65,7 @@ function render($data, $repeatCounter = 0)
foreach ($arVals as $tmpval) {
$tmpval = htmlspecialchars($tmpval, ENT_QUOTES); //for values like '1"'
$opts[] = JHTML::_('select.option', $tmpval, JArrayHelper::getValue($arTxt, $i));
if (is_array($selected) && in_array($tmpval, $selected)) {
if (in_array($tmpval, $selected)) {
if ($params->get('icon_folder') != -1 && $params->get('icon_folder') != '') {
$aRoValues[] = $this->_replaceWithIcons( $tmpval);
} else {
Expand All @@ -77,17 +77,9 @@ function render($data, $repeatCounter = 0)
//if we have added an option that hasnt been saved to the database. Note you cant have
// it not saved to the database and asking the user to select a value and label
if ($params->get('allow_frontend_addtodropdown', false) && !empty($selected)) {
// $$$ hugh - no idea why but sometimes $selected is an int, not an array
if (is_array($selected)) {
foreach ($selected as $sel) {
if (!in_array($sel, $arVals) && $sel !== '') {
$opts[] = JHTML::_('select.option', $sel, $sel);
}
}
}
else {
if (!in_array($selected, $arVals) && $selected !== '') {
$opts[] = JHTML::_('select.option', $selected, $selected);
foreach ($selected as $sel) {
if (!in_array($sel, $arVals) && $sel !== '') {
$opts[] = JHTML::_('select.option', $sel, $sel);
}
}
}
Expand Down

0 comments on commit b94c2e4

Please sign in to comment.