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

Date range Validation

I have one list In SharePoint  and the datasource name is project list.

One user doesn't work in another project in same date range for example 

 

Name.         Start date.                End date 

Basha.           1-jan-2022.             10-jan-2022

Basha.            9-jan -2022             20-jan-2022. ...etc ....

 

In above condition submit button should be  in disabled 

 

 

 

Name.    Start date.     End date 

Basha.     1-jan-2022.   10-jan-2022

Basha.      11-jan-2022.  20-jan-2022

 

In above case submit button should be edit mode

 

Please help me out ....date field should not be in overlapp format in this case I want to through error message and submit button should be in disabled mode

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-liwei-msft
Microsoft
Microsoft

 

Could you please tell me if your submit button is used to submit new records that meet the conditions?

I have made a test for your reference:

vliweimsft_0-1653472523967.png

 

 

vliweimsft_1-1653472523969.png

 

 

 



 

 

1. Create a form with new mode according to the data source. The form contains two date pickers to select the start time and end time.

 

2. The conditions for submission are:

 

Both the start time and the end time are less than the start time in the data source, or the start time is greater than the end time in the data source.

 

The start time is less than the end time.

 

If the name of the person in charge is different from the name in the data source, the above conditions need not be considered.

3. You can enter this formula in the displaymode property of the submit button:

If(
false in ForAll(
'525',
(start.SelectedDate < Startdate && end.SelectedDate < Startdate) && (end.SelectedDate > start.SelectedDate) Or (start.SelectedDate > Enddate) Or (name.Text <> Name)
),
DisplayMode.Disabled,
DisplayMode.Edit
)

Enter this formula in the onselect property:

SubmitForm(Form1)

 

 

Best Regards,

Levi

 

View solution in original post

rubin_boer
Super User
Super User

hi @Basha_Shaik in addition to the above you can try the following

 

Considering the dates are assigned by datepickers:

StartDate = dtStartDate

EndDate = dtEndDate

Submit button = btnSubmit

Project work end date = ProjectEndTime

 

btnSubmit's DisplayMode = If(dtEndDate.SelectedDate > Max(Filter(ProjectList,user = "Basha" /*from a dropdown or your control*/),ProjectEndTime)), Edit, Disbaled)

 

Hope it Helps

 

Regards,

R

 

 

View solution in original post

4 REPLIES 4
v-liwei-msft
Microsoft
Microsoft

 

Could you please tell me if your submit button is used to submit new records that meet the conditions?

I have made a test for your reference:

vliweimsft_0-1653472523967.png

 

 

vliweimsft_1-1653472523969.png

 

 

 



 

 

1. Create a form with new mode according to the data source. The form contains two date pickers to select the start time and end time.

 

2. The conditions for submission are:

 

Both the start time and the end time are less than the start time in the data source, or the start time is greater than the end time in the data source.

 

The start time is less than the end time.

 

If the name of the person in charge is different from the name in the data source, the above conditions need not be considered.

3. You can enter this formula in the displaymode property of the submit button:

If(
false in ForAll(
'525',
(start.SelectedDate < Startdate && end.SelectedDate < Startdate) && (end.SelectedDate > start.SelectedDate) Or (start.SelectedDate > Enddate) Or (name.Text <> Name)
),
DisplayMode.Disabled,
DisplayMode.Edit
)

Enter this formula in the onselect property:

SubmitForm(Form1)

 

 

Best Regards,

Levi

 

rubin_boer
Super User
Super User

hi @Basha_Shaik in addition to the above you can try the following

 

Considering the dates are assigned by datepickers:

StartDate = dtStartDate

EndDate = dtEndDate

Submit button = btnSubmit

Project work end date = ProjectEndTime

 

btnSubmit's DisplayMode = If(dtEndDate.SelectedDate > Max(Filter(ProjectList,user = "Basha" /*from a dropdown or your control*/),ProjectEndTime)), Edit, Disbaled)

 

Hope it Helps

 

Regards,

R

 

 

Thank you so much @v-liwei-msft  it really help me alot once again thank you so much 

 

Thank you so much for helping @rubin_boer 

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.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (5,375)