cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cf_amart
Frequent Visitor

DatePicker Error Message for selected date

I want an error message to appear if the date selected is NOT the 1st of the current month.  

 

So I have the following:

 

Capture.PNG

 

On the ErrorMessage box, in the Visible function I plugged in the the If function saying "if date equals 1st of month, say nothing, else, tell user 'try again' ". But I am getting a warning and if I select a date other than the 1st, it's not actually showing me the error message. 

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi@cf_amart,

Based on the issue that you mentioned, do you want the ErrorMessage box to pop up an error message once the selected date it not the first day of the month?

I want to explain to you that the ErrorMessage box is a Label where pop up an error message when this field is a Required field and you do not fill it out as you submit the form.

59.png

So even though you set the Visible property as true, there will not pop up an error message. You could use the Notify() function to custom the error message or set the Text property of the ErrorMessage box.

And for the error message that "expect a true or false value", it means that you should assign a boolean value for the corresponding condition. If the condition is meet, it could return true otherwise false. The Visible property expects a boolean value.

I agree with @Drrickryp for his solution, if you want a error message like that, you could take a try.

Here is my workaround, please check as follows.

Set the Text property of the ErrorMessage3 as  below:

 

"Select the first day of the month and try again!"

 

Set the Visible property of the ErrorMessage3 as  below:

 

If(DatePicker1.SelectedDate=Date(Year(Today()),Month(Today()),1),false,true)

 

60.png

Best Regards,

Qi

 

 

 

 

Best Regards,
Qi

View solution in original post

2 REPLIES 2
Drrickryp
Super User
Super User

Hi @cf_amart 

_1.png_2.png

v-qiaqi-msft
Community Support
Community Support

Hi@cf_amart,

Based on the issue that you mentioned, do you want the ErrorMessage box to pop up an error message once the selected date it not the first day of the month?

I want to explain to you that the ErrorMessage box is a Label where pop up an error message when this field is a Required field and you do not fill it out as you submit the form.

59.png

So even though you set the Visible property as true, there will not pop up an error message. You could use the Notify() function to custom the error message or set the Text property of the ErrorMessage box.

And for the error message that "expect a true or false value", it means that you should assign a boolean value for the corresponding condition. If the condition is meet, it could return true otherwise false. The Visible property expects a boolean value.

I agree with @Drrickryp for his solution, if you want a error message like that, you could take a try.

Here is my workaround, please check as follows.

Set the Text property of the ErrorMessage3 as  below:

 

"Select the first day of the month and try again!"

 

Set the Visible property of the ErrorMessage3 as  below:

 

If(DatePicker1.SelectedDate=Date(Year(Today()),Month(Today()),1),false,true)

 

60.png

Best Regards,

Qi

 

 

 

 

Best Regards,
Qi

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,280)