Browse Source

feat: add webform validation

pull/1483/head
natdeanlewissoftwire 3 years ago
parent
commit
273cdc0837
  1. 9
      app/models/validations/household_validations.rb
  2. 3
      config/locales/en.yml

9
app/models/validations/household_validations.rb

@ -112,6 +112,15 @@ module Validations::HouseholdValidations
end
end
def validate_layear(record)
return unless record.layear && record.renewal
if record.is_renewal? && record.layear == 1
record.errors.add :layear, I18n.t("validations.household.renewal_just_moved_to_area.layear")
record.errors.add :renewal, I18n.t("validations.household.renewal_just_moved_to_area.renewal")
end
end
private
def household_no_illness?(record)

3
config/locales/en.yml

@ -414,6 +414,9 @@ en:
reasonpref:
not_homeless: "Answer cannot be ‘no’ as the tenant was homeless or about to lose their home"
previous_la_known: "Enter name of local authority"
renewal_just_moved_to_area:
layear: 'For a renewal, you cannot select "just moved to local authority area"'
renewal: 'This cannot be a renewal as you told us the household "just moved to local authority area"'
gender:
retired_male: "Answer cannot be ‘male’ as tenant is under 65 and retired"
retired_female: "Answer cannot be ‘female’ as tenant is under 60 and retired"

Loading…
Cancel
Save