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 / Date Picker modified t...
Power Pages
Answered

Date Picker modified through javascript fails required field check

(0) ShareShare
ReportReport
Posted on by 167

I am dynamically setting the dates through javascript on a date picker field by changing the value of the datepicker_description input element. However, when I try to submit the record, the form gives me an error stating it is a required field. If I manually set the record myself, the error disappears.

 

gospa_0-1671641246990.png

gospa_1-1671641284630.png

 

I have tried adding the "dirty" class to the datepicker_description since that is what I observed that changed as soon as I manually key in a date but it's not working either. Any help would be appreciated.

 

gospa_2-1671641323208.png

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    Fubar Profile Picture
    17 Super User 2026 Season 1 on at

    Have you tried setting the Datepicker control (not the field)?

    Also could try doing a  $( "#fiieldname" ).change();

     

    Some date picker stuff - last one is setting a default date

    // disable the date field and picker
    $("#your_fieldname") // input control
     .next() // the date picker container
     .data("DateTimePicker") // the date picker object
     .disable();
    
    // enable the control after disabling
    $("#your_fieldname").next().data("DateTimePicker").enable();
    
    // show the date picker (like someone clicked the icon)
    $("#your_fieldname").next().data("DateTimePicker").show();
    
    // 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')) 
    
    // set a default date
    $("#your_fieldname") // input control
     .next() // the date picker container
     .data("DateTimePicker") // the date picker object
     .defaultDate(new Date("2020-01-01"));

     

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Mohsin Ali Profile Picture

Mohsin Ali 33

#2
sannavajjala87 Profile Picture

sannavajjala87 28 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 22 Super User 2026 Season 2

Last 30 days Overall leaderboard