# Specifying Number of Rows in Control() Select

**URL:** <https://discourse.cakephp.org/t/specifying-number-of-rows-in-control-select/9662>\
**Category:** Need Help\
**Created:** [August 27, 2021, 12:58am UTC](https://discourse.cakephp.org/t/specifying-number-of-rows-in-control-select/9662 "2021-08-27T00:58:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisW](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@ChrisW](https://discourse.cakephp.org/u/ChrisW)\
**Post date:** [August 27, 2021, 12:58am UTC](https://discourse.cakephp.org/t/specifying-number-of-rows-in-control-select/9662/1 "2021-08-27T00:58:18Z")

</div>

Thought this would be easy but has proven to be perplexing. I’m trying to increase the number of rows displayed in a control() select list. I was hoping it would be an option something like using rows=\> in a textarea() but no such luck.

Looks like the default is 4 rows. Any way to increase this?

Thanks

---

<div class="post-metadata">

**Author:** ![KevinPfeifer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kevinpfeifer/32/3365_2.png) [@KevinPfeifer](https://discourse.cakephp.org/u/KevinPfeifer)\
**Post date:** [August 27, 2021, 10:57am UTC](https://discourse.cakephp.org/t/specifying-number-of-rows-in-control-select/9662/2 "2021-08-27T10:57:47Z")

</div>

This works for me

```auto
echo $this->Form->control( 'comments', [
  'class' => 'js-tinymce',
  'rows' => 10,
  'templateVars' => [
    'size' => 'l-col-60',
    'icon' => 'text_fields',
    'tooltip' => __( 'Other information, that cannot be saved otherwise.' )
  ]
] );

```

where `templateVars` are custom variables I use in custom from templates.  
Please check [Form - 4.x](https://book.cakephp.org/4/en/views/helpers/form.html#customizing-the-templates-formhelper-uses) for more details on how to make your own templates

---

<div class="post-metadata">

**Author:** ![ChrisW](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@ChrisW](https://discourse.cakephp.org/u/ChrisW)\
**Post date:** [August 27, 2021, 11:50am UTC](https://discourse.cakephp.org/t/specifying-number-of-rows-in-control-select/9662/3 "2021-08-27T11:50:05Z")

</div>

As a test, I did try using the ‘rows’ option with no luck. Your example looks like it’s defining a text area which the rows option does work for. A simple example of what I’m trying to do is:

echo $this-\>Form-\>control(‘certifications.\_ids’, [  
‘options’ =\> $certifications,  
‘label’ =\> false,  
‘multiple’ =\> true  
]);

When this presents, I would really like to have it be a 6 line select field (or more) rather than a 4.

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [August 27, 2021, 2:14pm UTC](https://discourse.cakephp.org/t/specifying-number-of-rows-in-control-select/9662/4 "2021-08-27T14:14:20Z")

</div>

I think the relevant attribute for the select control is “size”, not “rows”.

---

<div class="post-metadata">

**Author:** ![ChrisW](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@ChrisW](https://discourse.cakephp.org/u/ChrisW)\
**Post date:** [August 27, 2021, 2:34pm UTC](https://discourse.cakephp.org/t/specifying-number-of-rows-in-control-select/9662/5 "2021-08-27T14:34:32Z")

</div>

Perfect. That worked. I don’t see that option anywhere in the documentation. Thanks for the help.

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [August 27, 2021, 4:25pm UTC](https://discourse.cakephp.org/t/specifying-number-of-rows-in-control-select/9662/6 "2021-08-27T16:25:56Z")

</div>

It’s not really a Cake specific thing. It’s one of many HTML attributes that can be put on things. Anything that Cake doesn’t have a specific knowledge of, it just passes through unchanged.

---

<div class="post-metadata">

**Author:** ![KevinPfeifer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kevinpfeifer/32/3365_2.png) [@KevinPfeifer](https://discourse.cakephp.org/u/KevinPfeifer)\
**Post date:** [August 27, 2021, 5:19pm UTC](https://discourse.cakephp.org/t/specifying-number-of-rows-in-control-select/9662/7 "2021-08-27T17:19:52Z")

</div>

Oh sorry, I misunderstood your question. I thought the rows attribute didn’t work for you when outputting a textarea 😅

---

<div class="post-metadata">

**Author:** ![ChrisW](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@ChrisW](https://discourse.cakephp.org/u/ChrisW)\
**Post date:** [August 27, 2021, 7:17pm UTC](https://discourse.cakephp.org/t/specifying-number-of-rows-in-control-select/9662/8 "2021-08-27T19:17:08Z")

</div>

No worries. I had not thought about injecting the HTML attributes as Zuluru suggested. Thanks again.
