Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

wordwrap in dropdown menu


patator

Recommended Posts

Hello,

 

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

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

Link to comment
Share on other sites

sorry to bump again

 

If the wordwraping is not possible in a dropdown menu , what would you advice :

 

- use a tooltip, but the question is how to implement a tooltip on a pulldown menu?

 

- some javascript like the pc creator contrib (I don't understand how the list is created).

 

 

Thanks for your help

Patrice

:'(

Link to comment
Share on other sites

Hi Patrice,

 

in all cases where the dropdowns got too long for my design, I resorted to radio buttons ... if you have many, you would need to have consider a div in which you can scroll ... maybe someone on here has such a code ready!

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Hello Monica

 

thanks for your answer..always on this forum helping people as I can see :)

 

I have too many entries for radio buttons (Under test)

 

I read somewhere that it would be possible to use div + onmouseover in select options, but I don't know how to proceed.

 

The best solution is obviously what has been developed for PC creator...but too far complicated to understand for me.

 

Patrice

Hi Patrice,

 

in all cases where the dropdowns got too long for my design, I resorted to radio buttons ... if you have many, you would need to have consider a div in which you can scroll ... maybe someone on here has such a code ready!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...