Topic: Stepper Custom Validators
I am looking for a code snippet that will stop and trigger validation on the stepper when the user clicks next. I have a script that compares values of two fields and if they are different i want to trigger validation and stop the stepper from proceeding. Any ideas? This below is not working:
const stepOne = document.querySelectorAll('.stepper .stepper-step')[0];
stepOne.addEventListener('onChangeStep.mdb.stepper', () => {
var a = parseFloat(approvalAmount.value.replace(/\$|,/g, ''));
var b = parseFloat(totalEngagementAmount.value.replace(/\$|,/g, ''));
if (a > b) {
stepOne.classList.add('data-mdb-stepper-invalid')
}
});
kpienkowska staff answered 2 years ago
I've prepared snippet for you: https://mdbootstrap.com/snippets/standard/kpienkowska/4897460
kelley pro premium commented 2 years ago
Hi, when i click on the link, i keep getting a 404 and then a pop up that says unauthorized
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 5.0.0
- Device: pc
- Browser: chrome
- OS: windows
- Provided sample code: No
- Provided link: No