• Resolved mercilesss

    (@mercilesss)


    Hi, so on my webpage im using Forminator forms. I have a field where the person who is requesting the information needs to provide the Date of Birth for the person who’s information is being requested -https://prnt.sc/TJkoeQIYPPEP

    How can i make it so whenever someone selects a Date of Birth that is not at least 21 years old to the current date – it shows them an error?

    For example, today 27 Dec 2023, the person can not select a date of birth younger than 27 Dec 2001 ( 21 years old at least )

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @mercilesss

    You can try this snippet and see whether it helps:
    https://gist.github.com/wpmudev-sls/5be15261d7f8835acda5a50dc3e3e46f

    The above snippet will show up the verification message when the form is submitted.

    In the given snippet, you’ll need to update the following line:

            private $field = 'date-1';
            // Form ID to validate
            private $form_id = 607;
            // Is necessary to have this minimum age or more to be able to do the submission
            private $minimum_age = 55;
            // Default message for the users with less than minimum age necessary
            private $message = 'You must be 55 or older to join the club!';

    Where “date-1” would be the ID of the date picker Field, the 607 would be the form ID which needs to be updated to your form ID and the 55 would be the minimum age which can be changed to 21.

    The $message in the above would be the error text which would appear after submission.

    Could you please check and see whether the above code helps? You can apply the code as a mu-plugins.

    Please check this link on how to implement the above code as a mu-plugins:
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    I can confirm the code works when tested. Please do let us know if you have any further queries.

    Best Regards,

    Nithin

    Plugin Support Dmytro – WPMU DEV Support

    (@wpmudevsupport16)

    Hello @mercilesss,

    Hope you’re doing great!

    As we haven’t heard from you for some time now, I’ll be marking this thread as resolved. Please feel free to ref-open it, if you still need our help.

    Best Regards,
    Dmytro

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Age Verification/Limit’ is closed to new replies.