Check for overlapping datetime

Is there a way to reject a submission if the requested duration (date time start and end) overlaps with a pre-existing booking?

Hello. Yes, you can compare the information submitted in the form with your pre-existing bookings to ensure no conflicts. If you have an overlap, you can return a validation error using the gform_field_validation filter:

Thanks, Chris, that’s exactly what I was after. Unfortunately, I am a developer, just not a PHP dev. I’ve found the date validation function, and it makes sense, but do you know of some example code I can use to query the db for bookings in the specified date range?

Hello. I don’t have any code on hand, but the general approach would be to know how the dates are stored (what format and is the data is stored in plain text or some other format), and where they are stored, and then determine the correct Gravity Forms or WordPress function to retrieve those. Then you can use PHP functions to compare the dates. If you start with “where the dates are stored and in what format” we might be able to get you a little closer. Thank you.

I see that you opened a new topic, so we can continue there: