Topic: Stepper data-validator not working

Huichofer pro asked 5 years ago


Hi, I'm having hard time trying to make data-validator to work. I've tried using it in the "Continue" button with a dummy false-returning function but it continues to the next step. In documentation it's not used at all so...is data-validator it working at all? According to other posts, seems it hasn't been working since some versions back.

function someFunction() {
     return false; //this should prevent to continue, but does nothing.
}

<div class="step-actions">
            <button class="waves-effect waves-dark btn btn-sm btn-primary next-step" data-validator="someFunction">CONTINUE</button>
          </div>

I tried to use data-feedback as a workaround but whenever my customized validation function returns false (therefore i don't call .nextStep()) the loading screen stays forever; I had to call .destroyFeedback() to overcome this stituation; but I wanna know if there's a better way to handle when data-feedback validations fail, or how to correctly use data-validator?

function someFunction() {
    if(validationFunction()){
         $('#my-stepper').nextStep();
     }
     else{
         $('#my-stepper').destroyFeedback();
     }
}
<div class="step-actions">
        <button class="waves-effect waves-dark btn btn-sm btn-primary next-step" data-feedback="someFunction">CONTINUE</button>
      </div>

Thanks


Piotr Glejzer staff commented 5 years ago

Yes, there is a problem with this data-validation. We have tasks for that but we dont fix this yet. I think your solution is good for now. Did you try to use data-validatotr with validationFunction()?


Huichofer pro commented 5 years ago

Yes, I tried with no success :(


Piotr Glejzer staff commented 5 years ago

Ok. We will check it soon.


germantellezv free commented 4 years ago

did you already fixed this? I'm needing it. After add stepers files and initialize script in my template when i click in the first next button it doesn't go to the next step and mark as wrong my first step


Mateusz Łubianka staff commented 4 years ago

Hi @germantellezv,

Can you show me an example of your code?

Best,


scottwilliams priority answered 4 years ago


Still broken in 4.19.1. Probably will never be fixed now that 5.0.0 is released.


Grzegorz Bujański staff commented 4 years ago

Hi. Sorry for that, we will fix it as soon as possible.



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: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.7.3
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No