• Resolved Mary Linville

    (@sunshine)


    I want to add some custom javascript validation to my PayPal form. I see that Forminator uses the jQuery Validation library, but it seems to load it differently than described by the library’s documentation. I have tried a few ways to add my custom logic but none seem to work (the closest I got actually *replaced all* the other validation logic, I want to *add* to it).

    Can you point me in the right direction?

    Thanks.

    • This topic was modified 3 years, 6 months ago by Mary Linville. Reason: adding link
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Laura – WPMU DEV Support

    (@wpmudev-support8)

    Hi @sunshine

    I hope you’re well today and thank you for your question!

    This would be a question for our developers mostly so I’ll be happy to ask them for advice but I’m sure they’ll ask for more information.

    Would you please tell a bit more of what/how you want to validate and/or what/what kind of code you’d like to use?

    Let us know (maybe a simple example or code and expected outcome?) and we’ll ask our developers for suggestions on how to “hook it up” to Forminator.

    Best regards,
    Adam

    Thread Starter Mary Linville

    (@sunshine)

    Thanks for the quick response.

    One thing I want to do is compare two email fields to ensure that they are equal. If not, like the other validations you add via the Forminator UI, it should halt form submission and display an error message.

    In my case, this will be fields email-1 and email-2.

    Since the aforementioned library is what is being used, I first tried calling jQuery.rules() using the equalTo rule and messages as the library documentation describes. But for some reason the rules() method could not be found no matter what I did.

    So when I saw that there was other stuff going on anyway, I tried to call the custom methods that Forminator has, like ForminatorFrontValidate() but I believe that was when I only succeeded in replacing the validation rules, not adding to them.

    I am probably close(?) I just can’t see it, LOL.

    Thread Starter Mary Linville

    (@sunshine)

    Ah, I think I may have figured it out.

    I use the forminator_field_email_validation_rules and forminator_email_field_validation_message filters, do I have that right?

    If that is right I will post back example code for others looking to do similar when I have it working.

    • This reply was modified 3 years, 6 months ago by Mary Linville.
    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @sunshine

    I hope you are doing well.

    Using JavaScript you can do something like this:

    https://gist.github.com/patrickfreitasdev/33a640f653dfad3abb29108557da58e1

    Or using PHP, but it will check on submit https://gist.github.com/patrickfreitasdev/12e75dd199799532875b319871904bf1

    Best Regards
    Patrick Freitas

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @sunshine ,

    We haven’t heard from you for some time now, so it looks like you don’t have any more questions for us.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Hook into jQuery Validator logic’ is closed to new replies.