Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Customize & Extend
Answered

Date Field Validation

(0) ShareShare
ReportReport
Posted on by 15

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?

 

  • Verified answer
    snaz Profile Picture
    15 on at
    Re: Date Field Validation

    @hugobernier your solution worked like a charm. Only change I had to do was to use maxDate

     

  • Verified answer
    Hugo Bernier Profile Picture
    on at
    Re: Date Field Validation

    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?

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics