%= form_tag '/forms', multipart: true, id: dom_id(form), data: {form_id: form.id} do %>
<% form.questions.each do |question| %>
-
<%= label_tag dom_id(question), question.title %>
<% if question.hint.present? %>
<%= question.hint %>
<% end %>
<% if [:check_box_tag].include? question.input_type %>
<% question.options.each do |option| %>
<%= send(question.input_type, "#{dom_id(question)}[]", option.id, false, required: question.is_required, id: dom_id(option), data: {form_question_id: question.id} ) %>
<%= label_tag dom_id(option), option.title %>
<% end %>
<%= text_field_tag "#{dom_id(question)}_other", "", data: {form_question_id: question.id} if question.has_other_option %>
<% elsif [:radio_button_tag].include? question.input_type %>
<% question.options.each do |option| %>
<%= send(question.input_type, dom_id(question), option.id, false, required: question.is_required, id: dom_id(option), data: {form_question_id: question.id}) %>
<%= label_tag dom_id(option), option.title %>
<% end %>
<%= text_field_tag "#{dom_id(question)}_other", "", data: {form_question_id: question.id} if question.has_other_option %>
<% elsif [:file_field_tag].include? question.input_type %>
<%= button_to_function "Select file", "fileUpload('#{dom_id(form)}', '#{dom_id(question)}', #{question.id})", style: "padding: 5px;" %>
<% else %>
<%= send(question.input_type, dom_id(question), "", required: question.is_required, data: {form_question_id: question.id}) %>
<% end %>
<% end %>
<% end %>
<%= button_to_function "Print", "$('##{dom_id(form)}').printElement({printMode:'popup'});", class: 'print', title: 'Print' %>
<%= button_to_function "Download PDF", "downloadPDF(#{form.id}, '#{dom_id(form)}')", class: 'save', title: 'Download PDF' %>
<%= button_to_function "Download", "download(#{form.id}, '#{dom_id(form)}')", class: 'save', title: 'Download' %>
<%= button_to_function "Send to JIPS", "deliver(#{form.id}, '#{dom_id(form)}')", class: 'send' %>