Hello, You can use this script to get the user age from date of birth date
After that you can use this python function to fire an alert and clear the field so he can enter a correct one frappe.throw("Your Age is less than 18") frm.set_value("date",)
frappe.throw("Your Age is less than 18")
frm.set_value("date",)