UI used #rows for form element for textarea and select

But select element should use #size

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost’s picture

Let's get 5 lines for select with multiple items

mitchell’s picture

Status: Needs review » Postponed (maintainer needs more info)

This changed the message type dropdown in "Show a system message" to a select list. Could you please show screenshots of the intended effect for this patch?

TR’s picture

Category: Bug report » Task
Priority: Normal » Minor
Issue summary: View changes
Status: Postponed (maintainer needs more info) » Needs review
FileSize
753 bytes

Re #2:

This changed the message type dropdown in "Show a system message" to a select list.

I assume you mean "Show a message on the site" ... Regardless, I can't reproduce that - it still shows a textarea for me after applying the patch and clearing the cache and verifying that the patch did indeed change the #size of selects.

I don't consider this a bug, because specifying #rows for a select element isn't wrong - the Form API allows us to use and pass around whatever arbitrary properties we want. The Form API just doesn't understand #rows for a select element, and will therefore ignore it. It doesn't generate an error, and doesn't output the wrong thing, because ANY property is allowed (as it might be added deliberately by custom code for internal use).

After trying out the patch, I noticed that if we do specify #size for selects, then the select will ALWAYS have that number of rows shown. I don't like this because if there are only two choices (e.g. "True" and "False") then there will still be 5 rows shown if #size=5. Whereas if we don't specify #size at all, then the default is 4 but it will only show 2 rows if only 2 choices are available. I think that is better.

So here is a new patch that removes the #rows property from the select element but keeps it for the textarea. It does NOT add #size to the select, as that is not needed. This patch does not affect the rendered HTML at all.

  • TR committed e2c9f83 on 7.x-2.x
    Issue #1675052 by andypost, TR: Input widget uses wrong #rows for select
    
TR’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.