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

Allow user to submit form if parameters are meet

Hello 

 

I've got a form with a Start and End Date on it. What I want to do is to have a save button that only allows the user to save the form if the current dates are changed to a another range of dates. I know I'd need some sort of If statement in before the Submit(Form1), but I'm unsure how to do this. Any ideas what code I could use to implement this? 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @southafrican ,

Do you want to verify date whether in a range of dates before submit form?

If so, firstly I suggest you use two date pickers to choose date.

And then set this formula to the save button's OnSelect:

If(DatePicker1.SelectedDate>date1&&
DatePicker1.SelectedDate<date2&&
DatePicker2.SelectedDate>date3&&
DatePicker2.SelectedDate<date4,SubmitForm(Form1)
)

Only if the date that you selecte in datepicker1 in range from date1 to date2 and the date that you selecte in datepicker2 in range from date3 to date4, the form will be submitted.

Please replace date1,date2,date3,date4 with the dates that you wan to limit, note that you could only replace with date value.

 

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

2 REPLIES 2
Super User III
Super User III

Hi @southafrican 

The answer from Carlos in this post describes how you can implement this type of validation.

https://powerusers.microsoft.com/t5/General-Discussion/Start-and-end-date-validation/m-p/52863

The answer in this post disables the submit button if the conditions are not met.

Community Support
Community Support

Hi @southafrican ,

Do you want to verify date whether in a range of dates before submit form?

If so, firstly I suggest you use two date pickers to choose date.

And then set this formula to the save button's OnSelect:

If(DatePicker1.SelectedDate>date1&&
DatePicker1.SelectedDate<date2&&
DatePicker2.SelectedDate>date3&&
DatePicker2.SelectedDate<date4,SubmitForm(Form1)
)

Only if the date that you selecte in datepicker1 in range from date1 to date2 and the date that you selecte in datepicker2 in range from date3 to date4, the form will be submitted.

Please replace date1,date2,date3,date4 with the dates that you wan to limit, note that you could only replace with date value.

 

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (6,987)