Changeset 1206
- Timestamp:
- 11/01/06 19:34:55 (2 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/filter/AgaviFormPopulationFilter.class.php
r1196 r1206 190 190 $p = $populate; 191 191 } else { 192 $p = $populate[$form->getAttribute('id')]; 192 if(isset($populate[$form->getAttribute('id')]) && (($p = $populate[$form->getAttribute('id')]) instanceof AgaviParameterHolder)) { 193 $p = $populate[$form->getAttribute('id')]; 194 } else { 195 continue; 196 } 193 197 } 194 198 … … 218 222 $pname = $matches[1][0]; 219 223 220 for($i = 0; $i < count($matches[2]); $i++) { 224 if($element->nodeName == 'select' && $multiple = $element->hasAttribute('multiple')) { 225 $count = count($matches[2]) - 1; 226 } else { 227 $count = count($matches[2]); 228 } 229 for($i = 0; $i < $count; $i++) { 221 230 $val = $matches[2][$i]; 222 231 if((string)$matches[2][$i] === (string)(int)$matches[2][$i]) { … … 338 347 339 348 } elseif($element->nodeName == 'select') { 340 $multiple = $element->hasAttribute('multiple');341 349 // select elements 342 350 // yes, we still use XPath because there could be OPTGROUPs 343 351 foreach($xpath->query('descendant::' . $ns . 'option', $element) as $option) { 344 352 $option->removeAttribute('selected'); 345 if($p->hasParameter($pname) && ($option->getAttribute('value') == $value || ($multiple && is_array($value) && in_array($option->getAttribute('value'), $value)))) {353 if($p->hasParameter($pname) && ($option->getAttribute('value') === $value || ($multiple && is_array($value) && in_array($option->getAttribute('value'), $value)))) { 346 354 $option->setAttribute('selected', 'selected'); 347 355 }

