web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Prevent form submissio...
Power Apps
Answered

Prevent form submission when selected time clashes with selected date's gallery items

(0) ShareShare
ReportReport
Posted on by 95

Hi all,

I have a gallery of items that are submitted through a form sorted by time. I would like to block out form submissions in the OnSelect Button when the selected date and time coincides with those in the gallery. Rationale is to block double bookings in the same timeslot. How do I achieve this?

Alois_0-1604934727729.png

Gallery of items referenced to calendar. Items are sorted by time.

Alois_1-1604934762012.png

Edit form with time selection parameters. 

Regards,
Alois

 

Categories:
  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Alois ,

     

    Could you please share more details about your scenario? Do you want to add a validation when picked date and time in Form have same values in the gallery? Since there are 3 columns of date and time as I see, which would you like to be used to do the validations? And what is the formula in that Form button? What column types are those date and time columns, Date or Text?

     

    If you want to use all 3 date and time fields values to do the validation, assuming you are using SubmitForm function and all that columns about date and time are DateTime type, you could apply below formula on that submit button.

     

    Set(varDay, DatePicker1.SelectedDate);
    Set(varPickT, DateTimeValue(Text(Concatenate(Text(DatePicker1.SelectedDate)," ",Dropdown1.Selected.Value,":",Dropdown2.Selected.Value),"[$-en-US]mm/dd/yyyy hh:mm "));
    Set(varSwabT, DateTimeValue(Text(Concatenate(Text(DatePicker1.SelectedDate)," ",Dropdown3.Selected.Value,":",Dropdown4.Selected.Value),"[$-en-US]mm/dd/yyyy hh:mm "));
    Set(varReturnT, DateTimeValue(Text(Concatenate(Text(DatePicker1.SelectedDate)," ",Dropdown5.Selected.Value,":",Dropdown6.Selected.Value),"[$-en-US]mm/dd/yyyy hh:mm "));
    If(IsEmpty(Filter(DataSource, Date = varDay, varPickT = PickUpTime || varSwabT = SwabTime || varReturnT = ReturnPickupTime)), SubmitForm(TimeFrom), Notify(“Some selected time clashes within that date”, NotificationType.Error))

     

    Also, if you have set those time values in the Update property of data cards, you could directly use DataCard.Update instead of those variables.

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard