Browse Source

Do not reset text field values (#333)

pull/334/head
kosiakkatrina 3 years ago committed by GitHub
parent
commit
e22fb262ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/models/case_log.rb

2
app/models/case_log.rb

@ -218,7 +218,7 @@ private
enabled = form.enabled_page_questions(self)
answer_options = enabled.map(&:id).include?(question.id) ? enabled.find { |q| q.id == question.id }.answer_options : []
contains_selected_answer_option = answer_options.present? ? answer_options.values.map { |x| x["value"] }.include?(public_send(question.id)) : false
if !contains_selected_answer_option && respond_to?(question.id.to_s)
if !contains_selected_answer_option && respond_to?(question.id.to_s) && (question.type == "radio" || question.type == "checkbox")
public_send("#{question.id}=", nil)
end
end

Loading…
Cancel
Save