# Form.select with images

**URL:** <https://www.ruby-forum.com/t/form-select-with-images/132689>\
**Category:** Rails\
**Created:** [March 23, 2008, 3:28pm UTC](https://www.ruby-forum.com/t/form-select-with-images/132689 "2008-03-23T15:28:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [March 23, 2008, 3:28pm UTC](https://www.ruby-forum.com/t/form-select-with-images/132689/1 "2008-03-23T15:28:52Z")

</div>

Hi,

Is it possible to use form.select in such a way that the selection  
values are images rather than text ?

I currently use an array like so

\<%= form.select :card\_type,  
[[ “display\_name\_1”, :value\_1],  
[“display\_name\_2”, :value\_2] ],  
{ :prompt =\> “Please Select…”} %\>

Instead of showing the text “display\_name\_1”, etc, I would like to  
display images.

Thanks!

---

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [March 24, 2008, 3:29am UTC](https://www.ruby-forum.com/t/form-select-with-images/132689/2 "2008-03-24T03:29:42Z")

</div>

John,

I think you’ll have to find a JavaScript control that does this. Here  
is one (look at “combobox with icons”)

> **[JavaScript UI Library, Ajax Components & HTML5 Framework - Customizable...](https://dhtmlx.com/docs/products/dhtmlxCombo/index.shtml)**
>
> Easily configurable JavaScript/HTML combobox with flexible customization and extensive API.

Then either embed it directly inside your view or via a JavaScriptHelper

Arshak

John L. wrote:

> Hi,
> 
> Is it possible to use form.select in such a way that the selection  
> values are images rather than text ?
> 
> I currently use an array like so
> 
> \<%= form.select :card\_type,  
> [[ “display\_name\_1”, :value\_1],  
> [“display\_name\_2”, :value\_2] ],  
> { :prompt =\> “Please Select…”} %\>
> 
> Instead of showing the text “display\_name\_1”, etc, I would like to  
> display images.
> 
> Thanks!
