<ul class='LSform' id='{$attr_name|escape:"htmlall"}'>
{if $freeze}
  {foreach from=$possible_values item=label key=value name=LSformElement_selectbox}
    {if is_array($label)}
      {if count($label.possible_values)>0}
        {foreach from=$label.possible_values item=l key=v name=LSformElement_selectbox_sub_values}
          {if in_array($v, $values)}
            <li>{$l|escape:"htmlall"}</li>
          {/if}
        {/foreach}
      {/if}
    {else}
      {if in_array($value, $values)}
        <li>{$label|escape:"htmlall"}</li>
      {/if}
    {/if}
  {/foreach}
  {foreach from=$values item=value}
    {LSformElement_select_checkIsValidValue value=$value possible_values=$possible_values}
    {if !$LSformElement_select_isValidValue}
    <li class='LSform-errors'>{getFData format=$unrecognized_value_label_format data=$value}</li>
    {/if}
  {foreachelse}
    <li>{$noValueTxt|escape:"htmlall"}</li>
  {/foreach}
{else}
  <li>
    <select name='{$attr_name|escape:"htmlall"}[]' {if $multiple}multiple{/if} class='LSformElement_select'>
      {foreach from=$possible_values key=key item=label}
        {if is_array($label)}
          {if count($label.possible_values)>0}
          <optgroup label='{$label.label|escape:"htmlall"}'>
            {html_options options=$label.possible_values selected=$values}
          </optgroup>
          {/if}
        {else}
          <option value='{$key|escape:"htmlall"}' {if in_array($key,$values)}selected{/if}>{$label|escape:"htmlall"}</option>
        {/if}
      {/foreach}
    </select>
  </li>
{/if}
</ul>
