%= form_for form_response, :as => 'form_response', :url => noodall_form_form_responses_path(form.id), :html => { :class => ('default-values' if params[:response].blank?) } do |f| %>
<%= f.hidden_field :referrer %>
<%= form.title %>
* Required
<%= error_messages_for :object => form_response %>
<% for field in form.fields %>
<% field_label = (field.label.blank? ? field.name : field.label) %>
<% unless field._type == 'Noodall::Radio' %>
<%= (f.label field.underscored_name, field_label) %><%= (field.required ? content_tag('span', ' *', :class => 'required') : '') %>
<% end %>
<% case field._type.gsub(/^.*::/,'')
when 'TextField'
if field.rows > 1 %>
<%= f.text_area field.underscored_name, :cols => 20, :rows => field.rows, :class => field.default_class(form_response) %>
<% else %>
<%= f.text_field field.underscored_name, :class => field.default_class(form_response) %>
<% end
when 'Select' %>
<%= f.select field.underscored_name, options_for_select(field.options.split(',').collect{|o| o.strip!;[o,o]}, form_response.send(field.underscored_name)) %>
<% when 'Radio' %>
<% when 'CheckBox' %>
<%= f.check_box field.underscored_name, {}, 'Yes', 'No' %>
<% end %>
<% end %>
<%= f.submit 'Send', :id => "form-submit" %>
<%= f.submit "Reset Form", :name => 'reset', :type => 'reset', :id => "form-reset" %>
<% end %>