Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Without submit button validate form elements in Magento

To add multiple steps before submit form. like:

Registration page:

  • Step 1 - Enter first, last name and email (validate on click of next button and show next step)
  • Step 2 - Enter Password and Confirm password and submit

Step 1 and step 2 are separate DIV's (Show/hide on Next Click)

like image 470
kiran Avatar asked Jul 30 '26 03:07

kiran


1 Answers

You can give a try of this JS snippet:

var formToValidate = $('place the id of the form, that I want to validate');
var validator = new Validation(formToValidate);
if(validator.validate()) {
    /* The logic, that you want to execute if you pass the validation. */
    ......
    ......
}

Good luck!

like image 197
ceckoslab Avatar answered Jul 31 '26 22:07

ceckoslab



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!