BUG 5934 "save labels for checkgroups.... solving problems"

This commit is contained in:
Erik Amaru Ortiz
2011-06-02 19:52:57 -04:00
parent 236585d03b
commit ab6abc2f0b
2 changed files with 29 additions and 19 deletions

View File

@@ -312,8 +312,14 @@ class Form extends XmlForm
case 'checkgroup':
case 'listbox':
if ( is_array($newValues[$k]) ) {
$values[$k] = '';
foreach ($newValues[$k] as $i => $value) {
//if $value is empty continue with the next loop, because this is a not selected/checked item
if (trim($value) == '') {
continue;
}
$values[$k] .= ($i != 0 ? '|': '') . $value;
if (isset($v->options[$value])){
@@ -336,6 +342,10 @@ class Form extends XmlForm
}
}
$newValues[$k] = $values["{$k}_label"];
} else {
$values[$k] = $newValues[$k];
$values["{$k}_label"] = $newValues["{$k}_label"];
}
break;
case 'dropdown':

View File

@@ -4177,7 +4177,7 @@ class XmlForm
if (isset ( $xmlNode [$k]->attributes ['required'] )) {
// the fields or xml nodes with a required attribute are put in an array that is passed to the view file
if ($xmlNode [$k]->attributes ['required'] == 1)
if ($xmlNode [$k]->attributes ['required'] == 1 && $xmlNode [$k]->attributes['mode'] != 'view' && $this->mode == 'edit')
$this->requiredFields [] = array ('name' => $field->name, 'type' => $xmlNode [$k]->attributes ['type'], 'label' => trim ( $field->label ) );
}