Skip to content

Commit

Permalink
Add check for support letter attachments in form validation
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniBitZesty committed Aug 28, 2024
1 parent 51dce7b commit eecc745
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/assets/javascripts/frontend/form-validation.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ window.FormValidation =
isCheckboxQuestion: (question) ->
question.find("input[type='checkbox']").length

isSupportLetterAttachment: (question) ->
question.find(".js-support-letter-attachment").length

toDate: (str) ->
moment(str, "DD/MM/YYYY")

Expand All @@ -81,6 +84,9 @@ window.FormValidation =
if @isCheckboxQuestion(question)
return question.find("input[type='checkbox']").filter(":checked").length

if @isSupportLetterAttachment(question)
return question.find(".js-support-letter-attachment-id").val().toString().trim().length

validateRequiredQuestion: (question) ->
# if it's a conditional question, but condition was not satisfied
conditional = true
Expand Down

0 comments on commit eecc745

Please sign in to comment.