web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / disable past/future da...
Power Pages
Answered

disable past/future date selection in power portal forms

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi everyone,

 

Another interesting problem. I have created different forms and I want to restrict the user so that he/she can only select past dates. How can I achieve this in power pages? 

 

@Lucas001 @saudali_25 any thoughts? Thanks!

 

Kind Regards,

Hafiz

Categories:
I have the same question (0)
  • Saud Ali Profile Picture
    812 Super User 2024 Season 1 on at

    Hi @Anonymous ,

     

    Just add validation using JavaScript on select of date. There is no OOB way available. Recently, I worked on a form where I had to check user data if user is over 18 to submit the request, I did it using JavaScript. 

     

    Feel free to ask, if you have any questions.

     

    Thanks,

    Saud

  • Verified answer
    Fubar Profile Picture
    8,491 Super User 2026 Season 1 on at

    You can disable dates via JavaScript/JQuery.  Note, this snippets below only apply to the picker, if you allow the user to manually type the date into the Input field you will need to apply additional validation

     

     

    // these would be inside a jQuery document.ready
    
    // disable dates in the past
    $("#your_fieldname").next().data("DateTimePicker").minDate(moment()) 
    
    // disable dates in the future (5 days in this example)
    $("#your_fieldname").next().data("DateTimePicker").maxDate(moment().add(5,'days')) 

     

     

     

    https://learn.microsoft.com/en-us/power-pages/configure/add-custom-javascript#additional-client-side-field-validation

     

    You'll find some other date picker snippets on this link post https://powerusers.microsoft.com/t5/General-Discussions/Date-Picker-modified-through-javascript-fails-required-field/m-p/1937874#M1916

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you so much @saudali_25 , @Fubar  for your suggestions and solution. It worked for me 🙂

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 52

#2
Valantis Profile Picture

Valantis 46

#3
Vish WR Profile Picture

Vish WR 29

Last 30 days Overall leaderboard