Jump to content

wordwrap in pulldown menu


patlegris

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.