cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alhilo
Helper III
Helper III

Validation dates

Hi

 

I have tow column in the list.

- Start date

- End Date

 

I want when the user enter end date less than start date the form should reject and give him message

 

 

Thank you 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @alhilo ,

1)You could check the control name on the left side:

10142.PNG

On your picture, you should choose that control and find it here:
10143.PNG

 

2)Do you want to :

if you select data in end date's datepicker earlier than data in start date's datepicker , you will get notification and the form could not be submitted?

If so, you should set like this:
set end date datepicker's OnChange:

If(startdatedatepickername.SelectedDate>=enddatedatepickername.SelectedDate,
   Notify("please do not select date earlier than start date",NotificationType.Warning)
)
//please replace with your startdatedatepickername and enddatedatepickername

 

set SharePointIntegration's OnSave:

If(startdatedatepickername.SelectedDate<enddatedatepickername.SelectedDate,SubmitForm(SharePointForm1), Notify("select wrong date"))

10144.PNG

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
timl
Super User III
Super User III
ChrisPiasecki
Super User
Super User

Hi @alhilo,

You could add the following formula to the field OnChange event:

If(Not(IsBlank(<endDate>)) And <endDate> < <startDate>, Reset(<endDate>); Notify(<error msg>, NotificationType.Error);)

 

It will clear the control and show an error notification at top of app. 

 

---

Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

 

Please note that the code doesn't work

 

please see the below link

 

https://ibb.co/bbWtP4v

 

Hi @alhilo,

Sorry, I should have clarified. Anything with  "< >" are just placeholders. Replace it with the name of your control and Selected Date properly (e.g, EndDateControl.SelectedDate). 

Thank you

 

how I can see the exact name for the control?

 

e.g the column name is Start date

 

is the space between start and date will be replaced by any thing? 

Hi @alhilo ,

1)You could check the control name on the left side:

10142.PNG

On your picture, you should choose that control and find it here:
10143.PNG

 

2)Do you want to :

if you select data in end date's datepicker earlier than data in start date's datepicker , you will get notification and the form could not be submitted?

If so, you should set like this:
set end date datepicker's OnChange:

If(startdatedatepickername.SelectedDate>=enddatedatepickername.SelectedDate,
   Notify("please do not select date earlier than start date",NotificationType.Warning)
)
//please replace with your startdatedatepickername and enddatedatepickername

 

set SharePointIntegration's OnSave:

If(startdatedatepickername.SelectedDate<enddatedatepickername.SelectedDate,SubmitForm(SharePointForm1), Notify("select wrong date"))

10144.PNG

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (40,608)