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 / Prevent Users from Cho...
Power Pages
Answered

Prevent Users from Choosing Today Date in Calendar

(0) ShareShare
ReportReport
Posted on by 17

Hello all,

How can i prevent users from choosing today's date in my entity form? I have created an entity form in edit mode. Users will have to edit and pick date in that form. But as a requirement, users must not be able to choose today's date. How can i achieve that in Power Apps Portal? I'm beginner here.

 

chitphyoaung_2-1600760789262.png

 

Untitled.png

 

 

 

Categories:
I have the same question (0)
  • oliver.rodrigues Profile Picture
    9,482 Most Valuable Professional on at

    Hi, you can add javascript validation on the submit of your entity form

    https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/add-custom-javascript

     

     

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

     

  • chitphyoaung Profile Picture
    17 on at

    can you please provide me an example javascript? 

  • Verified answer
    oliver.rodrigues Profile Picture
    9,482 Most Valuable Professional on at

    Hi @chitphyoaung 

     

    this would be an example:

    if (window.jQuery) {
     (function ($) {
     $(document).ready(function () {
     if (typeof (Page_Validators) == 'undefined') return;
     // Create new validator
     var newValidator = document.createElement('span');
     newValidator.style.display = "none";
     newValidator.id = "dateValidator";
     newValidator.controltovalidate = "birthdate";
     newValidator.errormessage = "<a href='#birthdate_label'>Birthdate can't be today or higher.</a>";
     newValidator.validationGroup = ""; // Set this if you have set ValidationGroup on the form
     newValidator.initialvalue = "";
     newValidator.evaluationfunction = function () {
     var birthdate = $("#birthdate").val();
     if (birthdate >= new Date().toISOString()) // your validation here
     {
     return false;
     } else {
     return true;
     }
     };
    
     // Add the new validator to the page validators array:
     Page_Validators.push(newValidator);
    
     // Wire-up the click event handler of the validation summary link
     $("a[href='#birthdate_label']").on("click", function () { scrollToAndFocus('birthdate_label','birthdate'); });
    });
     }(window.jQuery));
    }


    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 50

#2
Valantis Profile Picture

Valantis 26

#3
omkarsupreme Profile Picture

omkarsupreme 24

Last 30 days Overall leaderboard