Skip to content

Commit

Permalink
fixed a bug where getWarningState would always have a warning
Browse files Browse the repository at this point in the history
  • Loading branch information
FireLemons committed Nov 3, 2023
1 parent 9f4c84b commit faf68b1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/javascript/src/validated_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class NonDrivingContactMediumWarning extends ValidatableFormSectionComponent {
}

getWarningState () {
if (this.nonDrivingContactMediumCheckboxes.filter(':checked').length && this.milesDrivenInput.val()) {
if (this.nonDrivingContactMediumCheckboxes.filter(':checked').length && Number.parseInt(this.milesDrivenInput.val())) {
return 'You requested driving reimbursement for a contact medium that typically does not involve driving. Are you sure that\'s right?'
}

Expand Down Expand Up @@ -293,7 +293,9 @@ $(() => { // JQuery's callback for the DOM loading
})

safeInstantiateComponent('non driving contact medium warning', () => {
validatableFormSectionComponents.push(new NonDrivingContactMediumWarning(validatedFormCollection.find('.contact-medium.form-group input:not([type=hidden]), #case_contact_miles_driven'), pageNotifier))
const contactMediumWithMilesDrivenWarning = new NonDrivingContactMediumWarning(validatedFormCollection.find('.contact-medium.form-group input:not([type=hidden]), #case_contact_miles_driven'), pageNotifier)
console.log(contactMediumWithMilesDrivenWarning)
validatableFormSectionComponents.push(contactMediumWithMilesDrivenWarning)
})

validatedFormCollection.on('submit', function (e) {
Expand Down

0 comments on commit faf68b1

Please sign in to comment.