Skip to content

Instantly share code, notes, and snippets.

@lambdajitsu
Created July 21, 2008 21:29
Show Gist options
  • Save lambdajitsu/278 to your computer and use it in GitHub Desktop.
Save lambdajitsu/278 to your computer and use it in GitHub Desktop.
Rails form template
<% form_for :widget, :url=>widgets_path(@widget), :html=>{} do |f| %>
<% fields_for :person do |p| %>
<% 5.times do |i| %>
<%= p.select(:state, State.find(:all).collect {|s| [ s.title, s.id ]}, {}, {:index=>i, :style=>''}) %>
<%= p.text_field :zip, :size=>20, :index=>i %>
<%=
calendar_field "person_#{i}", 'born_string',
{ :class => 'date', :name => "person[#{i}][born_string]", :value=>Date.today)strftime("%m/%d/%Y"), :id=>"person_#{i}_born_string" },
{ :firstDay => 1, :range => [1900, 2008], :step => 1, :showOthers => true, :cache => true, :ifFormat => '%m/%d/%Y' }
%>
<%= p.country_select(:country, ['United States'], {}, :index=>i, :style=>'')%>
<%= p.text_area :some_text_area, :cols=>45, :rows=>5, :index=>i %>
<% end %>
<% end %>
<%=
calendar_field 'widget', 'created',
{ :class=>'date', :style=>'', :name=>'widget[created]', :value=>Date.today.strftime("%m/%d/%Y") },
{ :firstDay=>1, :range=>[1900, 2008], :step=>1, :showOthers=>true, :cache=>true, :ifFormat=>'%m/%d/%Y' }
%>
<%= f.radio_button("Active", true, :onclick=>"") %>Yes
<%= f.radio_button("In-active", false, :onclick=>"") %>No
<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;">
<%= options_for_select(question.options, custom_question_filter.dropdown_selections) %>
</select>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment