Skip to content

Commit

Permalink
fixed confirmation added once per validation
Browse files Browse the repository at this point in the history
  • Loading branch information
FireLemons committed Nov 10, 2023
1 parent 51b9d7e commit 36f5fd9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/javascript/src/validated_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,21 @@ class NonDrivingContactMediumWarning extends ValidatableFormSectionComponent {
}

showWarningConfirmation () {
this.checkboxContainer.append($(
if (!(this.warningConfirmationShown)) {
this.checkboxContainer.append($(
`<div class="warning-required-checkbox">
<input type="checkbox" id="warning-non-driving-contact-medium-check" class="form-check-input" required="true">
<label for="warning-non-driving-contact-medium-check">I'm sure I drove for this contact medium.</label>
</div>`
))
))
}

this.warningConfirmationShown = true
}

removeWarningConfirmation () {
delete this.warningConfirmationShown

this.checkboxContainer.find('.warning-required-checkbox').remove()
}
}
Expand Down

0 comments on commit 36f5fd9

Please sign in to comment.