quinta-feira, 22 de janeiro de 2009

select without submit Rails

I tried to submit a select at a page without using a submit button
in my view and I come to this, and works all right for me..
@my_array = [["select one value",-1],["ginger",1],["pepper",2],["mustard",3]]

<% form_for :my_form, :html => {:id => "my_form"},
:url => {:action => :receive_select} do |f| %>

<%= select :selection, :id, @my_array, {:selected => -1},
{:onchange =>"if (confirm(\"Confirm?\")) {this.form.submit();}"} %>
<% end %>

Nenhum comentário:

Postar um comentário