# If not text\_field, then what?

**URL:** <https://www.ruby-forum.com/t/if-not-text-field-then-what/124160>\
**Category:** Rails\
**Created:** [December 25, 2007, 8:41pm UTC](https://www.ruby-forum.com/t/if-not-text-field-then-what/124160 "2007-12-25T20:41:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [December 25, 2007, 8:41pm UTC](https://www.ruby-forum.com/t/if-not-text-field-then-what/124160/1 "2007-12-25T20:41:19Z")

</div>

I want the show.rhtml to generate a drop down list (I’ll deal with  
populating that list later). What’s the syntax please to generate a  
drop-  
down list?

All code at: [http://strawr.googlecode.com/svn/](http://strawr.googlecode.com/svn/)

Here’s what I have:

thufir@arrakis ~/Desktop $  
thufir@arrakis ~/Desktop $ tail strawr/app/views/feeds/show.rhtml

\<%= start\_form\_tag :action =\> ‘record’, :id =\> @category %\>

\<%= text\_field 'category', 'category'%\>

 \<%= submit\_tag 'Record!' %\> \<%= end\_form\_tag %\>

thufir@arrakis ~/Desktop $

thanks,

Thufir

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [December 25, 2007, 10:44pm UTC](https://www.ruby-forum.com/t/if-not-text-field-then-what/124160/2 "2007-12-25T22:44:17Z")

</div>

Quoting T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I want the show.rhtml to generate a drop down list (I’ll deal with  
> populating that list later). What’s the syntax please to generate a drop-  
> down list?

See the select helpers. [http://rails.rubyonrails.com/](http://rails.rubyonrails.com/) has nice  
documentation.

HTH,  
Jeffrey

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [December 26, 2007, 12:26am UTC](https://www.ruby-forum.com/t/if-not-text-field-then-what/124160/3 "2007-12-26T00:26:09Z")

</div>

On Tue, 25 Dec 2007 15:44:18 -0600, Jeffrey T. wrote:

> See the select helpers. [http://rails.rubyonrails.com/](http://rails.rubyonrails.com/) has nice  
> documentation.

Thanks, it certainly gets me started. I have an empty list and am now  
working on a query of the “categories” table to populate the list with  
all the categories:

thufir@arrakis ~/Desktop/strawr $  
thufir@arrakis ~/Desktop/strawr $ tail app/views/feeds/show.rhtml -n 2

thufir@arrakis ~/Desktop/strawr $

[http://strawr.googlecode.com/svn/trunk/app/views/feeds/show.rhtml](http://strawr.googlecode.com/svn/trunk/app/views/feeds/show.rhtml)

thanks,

Thufir
