如何绑定自定义操作以提交表单上的按钮?

时间:2011-11-15 14:27:12

标签: ruby-on-rails ruby forms

我做了一个表单,但我不知道如何从中收集数据,按下提交按钮后重定向用户添加/ fill.erb文件,这是我的表单:

  file: adding/counter.erb

  <%= simple_form_for :counter do |f| %>

  <%= f.input :first_name, :collection => 0..10 , :prompt => "How many?" %>

  <%= f.input :last_name, :collection => 0..10 , :prompt => "How many?" %>

  <%= f.input :city, :collection => 0..10 , :prompt => "How many?" %>

  <%= f.input :postal, :collection => 0..10 , :prompt => "How many?" %>

  <%= f.input :street, :collection => 0..10 , :prompt => "How many?" %>

  <%= f.input :job, :collection => 0..10 , :prompt => "How many?" %>

  <%= f.input :role, :collection => 0..10 , :prompt => "How many?" %>

  <%= f.button :submit, 'next step', :style => "margin-top: 20px;" %>
<% end %>

我知道这是一个蹩脚的问题,但我正在研究它几个小时,我不知道该怎么做:/

1 个答案:

答案 0 :(得分:1)

我不是很清楚,但听起来你试图设置表单发布到的URL?如果是这样,你应该能够这样做:

 <%= simple_form_for :counter, :url => {:controller => "counter", :action => "fill} do |f| %>