HTMLHelper Plugin:Using select() with options()

Am I using the select() helper with the options() method correctly?

From the doc’s I get the impression that I should be passing into the the options attribute of select() the html.options() method populated with the recordset of options with the value column name and the display column name plus any other extra arguments to rendered out as option attributes, like class.

When I do this I get a nested <option …> block rendered out to the browser.

It seems that options() return a complete set of <option …> values for each record in the values attribute as expected but the options attribute in select() then brackets the returned string with an <option …> tag with the contents of options() method injected into the value attribute of the <option …> tag.

So…

html.options(myRecordset, ‘ID’, ‘name’)

…returns…

display 1display 2display 3

…but…

html.select(name=‘mySelect’, options=html.options(myRecordset, ‘ID’, ‘name’))

…returns…

<option value=" display 1display 2display 3display 1display 2display 3">

Upon further investigation if I do…

html.select(name=‘mySelect’, options=myRecordset, column=‘ID’, nameColumn=‘name’))

…I get the right result but lose the ability to apply extra tag attribute to my <option…> tags.

Am I wrong or should select() be more intelligent around line 1078 when deciding what to do with the contents of the options argument?

thanks Richard, I updated the HTML helper now to do what you described, just in time for 3.5 final

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Thanks for the prompt fix Luis, works for me!