cakephpzurb-foundationdropdowncakephp-2.7

Dropdown list size with CakePHP


I am currently using CakePHP and I have a dropdown list that contains a lot of text. This is actually a list of predefined messages that the user can select.

I wonder if there is a way to tell CakePHP to keep the original size of the dropdown list to not allow text spans to the right, force a carriage return somehow.

I also use Foundation, can be a solution at this level too?

Thanks


Solution

  • You can add class or Id to that select box and apply css on that to control width of that box like:

    $options = array('M' => 'Male', 'F' => 'Female');
    echo $this->Form->select('gender', $options, array('escape' => false));
    

    Which will look like

    <select name="data[User][gender]" id="UserGender">
    <option value=""></option>
    <option value="M">Male</option>
    <option value="F">Female</option>
    </select>
    

    then add css like

    #UserGender {width : 200px;}