Custom validation for custom Date fields

  • Duncan Turnbull
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 10 months ago - 7 years 10 months ago #109573 by Duncan Turnbull
Custom validation for custom Date fields was created by Duncan Turnbull
Hi there.
As part of our registration for course we want to check ages. We collect the DOB and want to make sure the client's age will fit the course requirements. I think we could have an event field with an age range in it e.g. 12-18 and then a calculation to work out age based on DOB and whether it fits in that field.
But that would mean a calculation in the custom date validation and referencing some event related info. Is there any standard way to do this? Thanks very much. At the moment we do it when we receive the registration which means we need to call and double check some people. If the form checked that then that would be a useful addition
Thanks very much
Last edit: 7 years 10 months ago by Duncan Turnbull. Reason: missing word

Please Log in or Create an account to join the conversation.

More
7 years 9 months ago #109613 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Custom validation for custom Date fields
Hi Duncan

For that, I am afraid of you will need to implement validation using PHP code. Try to look at the file components/com_eventbooking/controller/register.php and customize the code of validateFormData method to implement this custom validation rule you want

Regards,

Tuan

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc