# Cannot have both select and radio\_button together on the same form

**URL:** <https://www.ruby-forum.com/t/cannot-have-both-select-and-radio-button-together-on-the-same-form/188874>\
**Category:** Rails\
**Created:** [May 19, 2010, 6:51pm UTC](https://www.ruby-forum.com/t/cannot-have-both-select-and-radio-button-together-on-the-same-form/188874 "2010-05-19T18:51:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![N.Li](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecccb3/32.png) [@N.Li](https://www.ruby-forum.com/u/N.Li)\
**Post date:** [May 19, 2010, 6:51pm UTC](https://www.ruby-forum.com/t/cannot-have-both-select-and-radio-button-together-on-the-same-form/188874/1 "2010-05-19T18:51:39Z")

</div>

Hello, I’m new to Ruby on Rails.

I am creating a form for searching purpose:

\<% form\_for :src\_cond,  
:url =\> {:action =\>‘search’} do |p| %\>  
\<%= p.radio\_button(“bd”, “1”) %\> a  
\<%= p.radio\_button(“bd”, “2”) %\> b  
\<%= p.select :bd2, %w[1 2 3 4],{},{:index=\>nil} %\>  
\<%= p.submit “Search” %\>  
\<% end %\>

When I click “Search”, the browser shows:

“We’re sorry, but something went wrong. We’ve been notified about  
this issue and we’ll take a look at it shortly.”

When I check the log, it says:

Status: 500 Internal Server Error  
expected Array (got Hash) for param `src\_cond’

I’ve put some “puts” statements in the controller, which indicates the  
controller is not called at all.

If I have only radio\_button or select in the form, the controller will  
be called as expected.

I wonder how I may have both combo box and radio group at the same  
time.

Many thanks!!

---

<div class="post-metadata">

**Author:** ![N.Li](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecccb3/32.png) [@N.Li](https://www.ruby-forum.com/u/N.Li)\
**Post date:** [May 19, 2010, 8:08pm UTC](https://www.ruby-forum.com/t/cannot-have-both-select-and-radio-button-together-on-the-same-form/188874/2 "2010-05-19T20:08:22Z")

</div>

What are you trying to achieve with {:index=\>nil} on the select  
helper?  
\<%= p.select :bd2, %w[1 2 3 4] %\> should work
