Hi all, is there a Rails way to associate an onclick event to a HTML
element and invoke
a controller's action?
<tr onclick="controller/action">
...
</tr>
I have a table, and I want to show some info when user click on a row.
Any better idea to achieve
this one?
Hi Eduardo,
Eduardo Yáñez Parareda wrote:
is there a Rails way to associate an onclick event to a HTML
element and invoke a controller's action?
<tr onclick="controller/action">
I could be wrong and don't have the time to verify this at the moment, but I believe that if you check the W3C spec you'll find that events can only be assigned to controls. AFAIK, a table (nor its component elements) is not a control. I think you'll need to use a link or button field as content of one of the table's cells. For those, check the link_to and button_to documentation at http://api.rubyonrails.org
hth,
Bill