Forum: Ruby on Rails Newbie: Radiobutton onclick

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.
80545dc99200b5b3ce28f599973a95ec?d=identicon&s=25 Abbath (Guest)
on 2005-12-29 16:06
(Received via mailing list)
Hi,

I would like to make a simple html which displays the contents of a
table from a database. So I put radiobuttons near the titles of the
columns to note and do a sorting by that column. But I don't know how
to implement that the clicking on one of the radiobuttons make the
sorting. The problem is the view part. How to give a radiobutton to
make some action on a click by the helper?

The code is:

-----
<table border="1">
        <tr>
                <% for col in Product.content_columns %>
                <td width="100"><%= radio_button :index, 'head',
col.name %><%= col.name %></td>
                <% end%>
        </tr>
        <% for prod in @product %>
                <tr>
                        <% for col in Product.content_columns %>
                                <td>
                                        <%= prod.send(col.name) unless
(prod.send(col.name).to_s == "") %>
                                        <%= "&nbsp;" if
(prod.send(col.name).to_s == "") %>
                                </td>
                        <% end %>
                </tr>
        <% end %>
        <tr>
</table>
-----

Thanks.

Abbath
This topic is locked and can not be replied to.