Posted By

jonallanharper on 04/29/08


Tagged

form rails ruby


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

lakedenman
aka
webstic
davidsi
octoberborn


Rails Form


 / Published in: Rails
 

  1. <% form_for :widget, :url=>widgets_path(@widget), :html=>{} do |f| %>
  2.  
  3. <% fields_for :person do |p| %>
  4. <% 5.times do |i| %>
  5. <%= p.select(:state, State.find(:all).collect {|s| [ s.title, s.id ], {}, {:index=>i, :style=>''}) %>
  6. <%= p.text_field :zip, :size=>20, :index=>i %>
  7. <%=
  8. calendar_field "person_#{i}", 'born_string',
  9. { :class => 'date', :name => "person[#{i}][born_string]", :value=>Date.today)strftime("%m/%d/%Y"), :id=>"person_#{i}_born_string" },
  10. { :firstDay => 1, :range => [1900, 2008], :step => 1, :showOthers => true, :cache => true, :ifFormat => '%m/%d/%Y' }
  11. %>
  12. <%= p.country_select(:country, ['United States'], {}, :index=>i, :style=>'')%>
  13. <%= p.text_area :some_text_area, :cols=>45, :rows=>5, :index=>i %>
  14. <% end %>
  15. <% end %>
  16.  
  17. <%=
  18. calendar_field 'widget', 'created',
  19. { :class=>'date', :style=>'', :name=>'widget[created]', :value=>Date.today.strftime("%m/%d/%Y") },
  20. { :firstDay=>1, :range=>[1900, 2008], :step=>1, :showOthers=>true, :cache=>true, :ifFormat=>'%m/%d/%Y' }
  21. %>
  22.  
  23. <%= f.radio_button("Active", true, :onclick=>"") %>Yes
  24. <%= f.radio_button("In-active", false, :onclick=>"") %>No
  25.  
  26. <select name="custom_question_filter[<%=unique_per_custom_question_filter%>][dropdown_selections][]" size="<%=num_or_max(question.options.size)%>" multiple="multiple" style="border:2px solid #ccc;width:180px;">
  27. <%= options_for_select(question.options, custom_question_filter.dropdown_selections) %>
  28. </select>
  29.  
  30. <% end %>

Report this snippet  

You need to login to post a comment.