Forum: Ruby on Rails Radio buttons in forms

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Demec (Guest)
on 2009-04-28 15:25
(Received via mailing list)
<% 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
This topic is locked and can not be replied to.