Jump to content


Photo

wordwrap in pulldown menu


  • Please log in to reply
No replies to this topic

#1 patlegris

patlegris
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 19 August 2006 - 02:12 PM

Hello,

I'm trying to find a solution to split on different rows a long text being displayed in pulldown menu (text populated from sql).

I tried the following but it didn't work :

// Output a form pull down menu
  function tep_draw_pull_down_menu3($name, $values, $default = '', $parameters = '',$required = false) {
    $field = '<select id="' . tep_output_string($name) . '" name="' . tep_output_string($name) . '"onChange="majOption(this)"';
    
    if (tep_not_null($parameters)) $field .= ' ' . $parameters;

    $field .= '>';

    if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);
    $field.='<option value="SELECTION">'.SELECT.'</option>';
    for ($i=0, $n=sizeof($values); $i<$n; $i++) {
    
      $field .= '<option value="' . tep_output_string($values[$i]['id']) . '"';
      if ($default == $values[$i]['id']) {
        $field .= ' SELECTED';

      }

    ///HERE IS THE WRAPPING/////

    $test=wordwrap ($values[$i]['text'],5,"<BR />", 1);



      //$field .= '>' . tep_output_string($test, array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>';
    $field .= '>' . $test .'</option>';
    }
    $field .= '</select>';

    if ($required == true) $field .= TEXT_FIELD_REQUIRED;

    return $field;
  }


Any idea how could I do ?

Thanks
Pat




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users