Jump to content

Archived

This topic is now archived and is closed to further replies.

patlegris

wordwrap in pulldown menu

Recommended Posts

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 :
[code]

// 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;
  }

[/code]

Any idea how could I do ?

Thanks
Pat

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.