3

I have created one calendar list for a meeting room in SharePoint 2013. How can I warn the user for double booking and overlapping events without using C# code?

1

Sharepoint 2013 has a very rich java script object model. This gets even easier to use with third party libraries such as spservices. Worth looking into this.

You could use the already existing java script function PreSaveAction() which allows you to inject your own validation to a form. Using this you could query the current calendar and see if there are any conflicts with the date range the user has selected. If there is a conflict the PreSaveAction function can be set to return false so the item is not saved and an error message displayed. This will allow the user to then change the date range before saving again.

If you need any more guidance on this I'd he happy to help

Tal

EDIT

The form web part will have a parameter called JSLink which will allow you to load javascript files with your web part. This is meant for overriding the rendering of fields and views but can be used to load javascript files as well.

If you create a javascript file and inside create a function called PreSaveAction() SharePoint will recognise this and process the script before it submits the form. It will expect a result from the function of true or false. If the result is true the form will submit and if it is false the form will not submit.

In your PreSaveAction() function you can query your calendar and find appointments that conflict with the current appointment being made. If there is a conflict you would tell your function return false and also display some error message. If there is no conflict it will return true and SharePoint can save the list item.

I am afraid I can't go into too much more detail than that short of writing the code for you :-) but there is lots of information online about presave action. If you also load the JQuery library and SPServices javascript libraries in your JSlink you will be able to achieve this result with much less code.

Just to clarify, your original question was how to do it without C#, so this is a javascript solution. There is no way to solve this problem without code of some sort.

Please mark as helpful if this has helped you

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.