Skip Navigation

[Resolved] Validate date of birth if it’s over 18

This thread is resolved. Here is a description of the problem and solution.

Problem:

I need that, on registration page, a user insert his/her birthdate and, only if the user is over 18, is allowed to subscribe himself.
If is under 18 he cannot continue.

I know how to check if the date is validated or not, but i don't know how to pass the value of the field: [cred_field field='data-di-nascita'] to the js code.

Solution:

There isn't such a built-in feature within CRED form, see our document:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field

In the shortcode [cred_field], there isn't such a feature that can achieve what you want:
pass the value of the field: [cred_field field='data-di-nascita'] to the js code

You may consider some custom codes, for example, you can setup your own datapicker with some Jquery UI datepicker, setup the year range as what you want

Relevant Documentation:

http://api.jqueryui.com/datepicker/#option-yearRange

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by vitoV 6 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#613511

I need that, on registration page, a user insert his/her birthdate and, only if the user is over 18, is allowed to subscribe himself.
If is under 18 he cannot continue.

I know how to check if the date is validated or not, but i don't know how to pass the value of the field: [cred_field field='data-di-nascita'] to the js code.

You can check the behaviour at the page hidden link

#613597

Dear Vito,

There isn't such a built-in feature within CRED form, see our document:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
In the shortcode [cred_field], there isn't such a feature that can achieve what you want:
pass the value of the field: [cred_field field='data-di-nascita'] to the js code

You may consider some custom codes, for example, you can setup your own datapicker with some Jquery UI datepicker, setup the year range as what you want, see jquery UI:
hidden link

#613929

Hi, thanks for your reply, i've resolved anyway with hardcoding Js

Thank anyway

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.