correction dans le helper probleme avec les selected des selects...

This commit is contained in:
Damien LASSERRE 2012-02-16 09:15:14 +00:00
parent fe2e2dfb74
commit 80e12eda14

View File

@ -135,12 +135,12 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
if(is_array($sessionValeur)) if(is_array($sessionValeur))
$sessionValeur = implode(',', $sessionValeur); $sessionValeur = implode(',', $sessionValeur);
$return = '<select class="criteres '.$field['type']['class'].'" name="'.$name.'">'; $return = '<select class="criteres '.$field['type']['class'].'" name="'.$name.'">';
$return .= '<option value="tous">Tous</option>'; $return .= '<option '.(($sessionValeur == 'tous')?'selected':'').' value="tous">Tous</option>';
foreach($field['fields'][$field['type']]['value'] as $value => $label) { foreach($field['fields'][$field['type']]['value'] as $value => $label) {
$selected = ""; $selected = "";
if(($sessionValeur != null) and $sessionValeur == $value) if(($sessionValeur != null) and $sessionValeur == $value and $sessionValeur != "tous")
$selected = " selected"; $selected = " selected";
$return .= '<option'.((!empty($selected))?$selected:null).' value="'.$value.'">'.$label.'</option>'; $return .= '<option'.$selected.' value="'.$value.'">'.$label.'</option>';
} }
$return .= '</select>'; $return .= '</select>';
return ($return); return ($return);