There seemed to be many ways to do this, but all adhoc and no complete solutions. So I present the following. Example in bottom screenshot.
In your Nintex Form (classic).
3. (Optional) - Remove the Recurrence label and control from the form. If you don't, it will be hidden anyway.
You can also update the Error Text value on the second line if you wish to change the default.
Note: This solution is working on the assumption that your region date format is dd/MM/yyyy. If you need to use MM/dd/yyyy, please un-comment Line 29 (remove leading 2 forward slashes). Then comment Lines 25 & 26 (add 2 forward slashes to the start of each line).
6. Save and Publish your form.
If there is an existing booking an error is displayed and the Save buttons are disabled. When a period is specified that doesn't already have a booking, the Save buttons are enabled again and the error is no longer displayed.
I have also expanded the solution to work with an additional column e.g. a resource like a Hot Desk. So if you have multiple Hot Desks or resources. It would validate that, that resource isn't booked already.
Enjoy! This one took a while to put together.
Nice post thank you, but I guess this isn't function for 24hours date format. Only for 12 hours isn't it?
I tried several time without success. Any help with that? And one more question If I have on Button (Save) my own value it's OK?
It uses the date/time picker control, so not 24hr format. Just the value selected in your control. Also you can have any label applied to your save button.
What issues were you facing?
But for me this solution doesnt work.
In the code if you check (hoursArray == AM) 12 etc.
But we use 24h region format so maybe this could be the reason ...
Or this is compatible for each "Local date/time" 12 or 24 format. ? 😉
So I've chcked in Mozilla debugger and get this error on opening form.
RangeError: invalid date NewForm.aspx:1504:19
var isoDate = new Date(fullDate.getTime() - (fullDate.getTimezoneOffset() * 60000)).toISOString();
Any help ?
So I've tested again on EN regional settings with format of date 01/01/1991 and timezone 12h. It works perfect, but there is problem when I change to 24h. format.
And also if is changed regional setting to another language because then you have date liek this 01. 01. 1991 and the script can't work anymore.
So is there any chance how to edit the script for working also with those regional settings ?
I've updated @shaneoss' script so that it works for dates with a spaces in their formatting.
there are several bugs in NINTEX code that cause NINTEX do not correctly works with date formats that include a space, or include (accidentally) one more space, or doesn't include a space but space is expected, or a different separator is used then expected, etc.,
PLENTY OF problem in date/time handling in nintex products, especially if you use other then EN/US locale.
unfortunatelly, NINTEX refuses to fix it!
may I ask you what exact locale do you use?
could you perharps log an incident with NINTEX support that you experience problems with these date formats?
if they had more incidents reported for the problem, they might, hopefully, took it a bit more seriously...
Sorry @heget missed your previous posts. Yes no consistency with dates and locales across the Nintex suite as emha has mentioned. Wish there was. 🙂 It would make coding custom Nintex solutions alot easier for the global audience where time/date formats were involved.
Any issues just lets us know.
Hello, @shaneoss where in your modified code do you add the script to take into consideration the resources field and the start and end dates? What is that field named? What type of field is it? If the resources field allows the user to select resources 1, 2, and 3 and if someone has all 3 resources booked already it will throw an error if someone is trying to also book resource 1, 2, or 3 on the same date(s). Or is each resource a separately named field?