# Radio buttons in forms

**URL:** <https://www.ruby-forum.com/t/radio-buttons-in-forms/166673>\
**Category:** Rails\
**Created:** [April 28, 2009, 1:25pm UTC](https://www.ruby-forum.com/t/radio-buttons-in-forms/166673 "2009-04-28T13:25:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![demec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f05b48/32.png) [@demec](https://www.ruby-forum.com/u/demec)\
**Post date:** [April 28, 2009, 1:25pm UTC](https://www.ruby-forum.com/t/radio-buttons-in-forms/166673/1 "2009-04-28T13:25:21Z")

</div>

\<% form\_for @group do |g| %\>

```
To create a new group please complete the details below

<p>
    <label> Group Name </label>
    <%= g.text_field :name %>
</p>

<p>
    <label> Public </label>
    <%= g.radio_button :type, "public" %>
    <label> Private </label>
    <%= g.radio_button :type, "private" %>
    <label> Secret </label>
    <%= g.radio_button :type, "secret" %>
</p>

<%= submit_tag(value = "Create group") %>

```

\<% end %\>

=====================  
above is the code in my view, in my group model i defined :type as  
null =\> false  
when i click on the create button a get an error, Validation failed  
Type cant be blank.

Is there anything wrong the way I created my radio-buttons ? Because I  
assume they do not assign the value to :type

Thanx,  
Demetris
