On my cursory reading of the docs and code in hs, it seemed that the key to getting a
format HS was to combine $element['#config']['multiple'] = 1 and/or $element['#config']['save_lineage']. This wasn't the case.

It took a while to discover that the key was actually just to set $element['#size'] to a value higher than 1.

It would be helpful if API.txt or the examples at Wim's site could make this connection explicit, as I didn't realise that Drupal used the same term ('#size') to refer to both horizontal sizes (textfield) and vertical (select).

http://drupal.org/node/212014 requested this.

Thanks!

Comments

xurizaemon’s picture

NB - the link above references the request for this feature to be implemented, not documented.

wim leers’s picture

Title: Doc request: Instructions for generating select type=multiple selects with HS » Document how to generate a HS with selects with multiple rows more explicitly
Assigned: Unassigned » wim leers
Category: support » task
Priority: Normal » Minor

Agreed. I only found out about the #size property myself very, very late. However, your title and interpretation is wrong :)

Setting #size to >1 does *not* generate #multiple = TRUE selects! Give it a try: you won't be able to select multiple options, even when JS is disabled. HTML also has a size attribute for the select element, this is not something Drupal-specific.

I still agree that the documentation should clarify this though, we can't expect everybody to know every detail of the HTML spec :)

xurizaemon’s picture

Title: Document how to generate a HS with selects with multiple rows more explicitly » Doc request: Instructions for generating select type=multiple selects with HS
Assigned: wim leers » Unassigned
Category: task » support
Priority: Minor » Normal

That is interesting, thanks Wim, and makes more sense of why Drupal's parameter is named such.

I had thought that
referred to both the visible rows and whether multiple items were selectable.

As you say,
is quite legal. multiple=true seems to imply size=>1, and for that reason I've been abusing multiple=true for a disturbingly long time. Glad to be corrected!

HS is a simply awesome module, Wim. Very much appreciate your efforts.

xurizaemon’s picture

Title: Doc request: Instructions for generating select type=multiple selects with HS » Document how to generate a HS with selects with multiple rows more explicitly
Category: support » task
Priority: Normal » Minor

Ugh - my reply reset the fields to the old values. Reverting, but can't reassign to Wim.

wim leers’s picture

Version: 5.x-3.0-rc7 » 6.x-3.x-dev
wim leers’s picture

Title: Document how to generate a HS with selects with multiple rows more explicitly » Document how to generate a HS with selects with multiple "rows" more explicitly
Assigned: Unassigned » wim leers
Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

ptoly’s picture

I love HS. Great work!

However I need to set a static height for the HS. However I can't make heads or tails of which file I need to modify..

Where is #size? Where is #multiple?

Reading between the lines it is a Drupal parameter that needs to be modified. I'm not at all clear where I should change the settings.

Any help appreciated!