Merge pull request #2740 from differentreality/survey_question_validation
Fix JS error when saving survey_question
This commit is contained in:
commit
5e70690619
2 changed files with 3 additions and 3 deletions
|
|
@ -11,8 +11,8 @@ class SurveyQuestion < ActiveRecord::Base
|
||||||
|
|
||||||
validates :title, presence: true
|
validates :title, presence: true
|
||||||
validates :possible_answers, :max_choices, :min_choices, presence: true, if: :choice?
|
validates :possible_answers, :max_choices, :min_choices, presence: true, if: :choice?
|
||||||
validates :min_choices, numericality: { greater_than_or_equal_to: 1 }, allow_blank: true
|
validates :min_choices, numericality: { greater_than_or_equal_to: 1 }, allow_blank: true, if: :choice?
|
||||||
validates :max_choices, numericality: { greater_than_or_equal_to: 1 }, allow_blank: true
|
validates :max_choices, numericality: { greater_than_or_equal_to: 1 }, allow_blank: true, if: :choice?
|
||||||
|
|
||||||
validate :max_choices_greater_than_min
|
validate :max_choices_greater_than_min
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
= f.input :title
|
= f.input :title, input_html: { autofocus: true }
|
||||||
= f.input :mandatory
|
= f.input :mandatory
|
||||||
.survey-possible-answers{ class: @survey_question.choice? ? '' : 'hidden' }
|
.survey-possible-answers{ class: @survey_question.choice? ? '' : 'hidden' }
|
||||||
= f.input :possible_answers, hint: 'Comma separated', input_html: { rows: 3 }
|
= f.input :possible_answers, hint: 'Comma separated', input_html: { rows: 3 }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue