Too Long Option Value In Dropdownlist


I have never had to work with too long <OPTION> values in drop-down lists and didn’t even imagine what problems they could cause.

I have a drop-down:

<?php echo $form->dropDownList($model,'economic_sector', CHtml::listData(AppSector::model()->findAll(), 'id', 'sectorTitle'),array('style'=>'width:440px;','empty' => '-- Please, indicate --')); ?>

And it has some terribly long values, like:

Manufacture of food products and beverages, including fruit and vegetable processing and including wine production based on local natural raw material



partially solves the problem, but:

  1. It doesn’t work in webkit browsers like Chrome;

  2. It just cuts the string by 440px and the remaining contents is not visible.

How would you struggle with this? As for as I understood, the ONLY way is to emulate dropDownList with jQuery, but it is the dark forest for me… Load, validate and save data lead me to an even greater horror.

Do you have any suggestions?

Thank you

Possibly add ‘overflow-x:scroll;’ to your style.

Not all visual aspects of options from a select can be controlled by CSS and not all hacks work for all browsers. Thus a better approach is to use a jQuery select box manipulation plugin.