Topic: Stepper Custom Validators

kelley premium asked 1 year ago


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')
} });


Kamila Pieńkowska staff answered 1 year ago


I've prepared snippet for you: https://mdbootstrap.com/snippets/standard/kpienkowska/4897460


kelley premium commented 1 year ago

Hi, when i click on the link, i keep getting a 404 and then a pop up that says unauthorized



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Premium
  • 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