cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Do not allow saving the form if a Datafield is filled in incorrectly

I have two date fields. If I fill in DataCardValue2 with a date value less than DataCardValue1, I get the notification that the date value must be greater than or equal to DataCardValue1.

But, I can save the form in the same way, even if the date value is incorrect. And I would not like it to be saved with the wrong date value, but rather that it would not allow saving.

 

This is possible? 

1 ACCEPTED SOLUTION

Accepted Solutions

Am surprised the formula didn't work. It may well be that you have to turn the Datacaradvalue like;

If(DataCardvalue1.SelectedDate<

DataCardvalue2.SelectedDate, Notify ("StartDate should be equal or less Then EndDate"),SubmitForm(YourformName)

 

If it doesn't work show a screenshot of the formula and the Datacaradvalues with the dates entered in them

 

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

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.

View solution in original post

6 REPLIES 6
eka24
Super User
Super User

On the Onselect of the save button, you can use the formula

 

If(DataCardvalue1.SelectedDate>

DataCardvalue2.SelectedDate, Notify ("StartDate should be equal or less Then EndDate"),SubmitForm(YourformName)

 

Replace SubmitForm(YourformName) with Patch formula if using patch

 

Thus if the criteria if not met, the form will not be saved.

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

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.

Anonymous
Not applicable

it didn't work, it still allows saving.

Set the property "Required" of the datacard to be true, then add the restrictions in the property "Update", when you submit the form, if the value in datacard is not valid, it will fail to submit.

Anonymous
Not applicable

this error appears below

The error showed you didn't give the datacard a date value. 

In the formula:

You can not add Notify in If in Update, it should be like this : If(..condition.., datevalue)

 

Here is an example in my app:

If(DatePicker1.SelectedDate>=Today(),DatePicker1.SelectedDate)

Am surprised the formula didn't work. It may well be that you have to turn the Datacaradvalue like;

If(DataCardvalue1.SelectedDate<

DataCardvalue2.SelectedDate, Notify ("StartDate should be equal or less Then EndDate"),SubmitForm(YourformName)

 

If it doesn't work show a screenshot of the formula and the Datacaradvalues with the dates entered in them

 

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

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.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,400)