I am showing a date field on the portal in advanced web forms. I now need to ensure that only users who are 18+ years of age can enter their date of birth. Does any one know how to do this?
I am showing a date field on the portal in advanced web forms. I now need to ensure that only users who are 18+ years of age can enter their date of birth. Does any one know how to do this?
@hugobernier your solution worked like a charm. Only change I had to do was to use maxDate
At the moment, the easiest way to do something like this is to go to the Portal Management app (from the Apps tab in make.powerapps.com) and navigate to Basic Forms .
Find the where you want to add validation and open it. Find the Additional Settings tab and scroll to the Custom JavaScript section and add the script you want to set the minimum date of the field to 18 years ago.
$(document).ready(function() {
$("#yourfieldgoeshere").next().data("DateTimePicker").minDate(moment().add(-18, 'years'));
});
(Disclaimer: I wrote the above code without testing it, please forgive for any errors).
I hope this helps?