This is the documentation for ConfiForms Server/Data Center app
However, this might also work for ConfiForms cloud and in most cases it does. But please see this page to understand the differences between server and cloud versions of the ConfiForms app.
This tutorial shows how to design a form with custom validation rule to ensure date time intervals registered with this form dont overlap
Here is what we have in our form - just 2 fields
We want to ensure the events dont overlap, so we will add a custom validation rule to our form
With action "Validation rule" agains dataset
And condition to check that intervals dont overlap like this
(eventDT.startDate:<=[entry.eventDT.endDate] AND eventDT.endDate:>=[entry.eventDT.startDate] AND !id:[entry.id])
We will show the form data in a CalendarView like this:
This is done by simply configuring CalendarView to use our form and have a calendar built using "eventDT" field
When you try to register an event with dates overlapping the ones we have already registered an error message is shown (the one we have defined in our custom validation rule)
Full storage format for this demo can be found below
<ac:structured-macro ac:macro-id="e4550d98-9658-494f-bbb1-b7aa117d6109" ac:name="confiform" ac:schema-version="1"> <ac:parameter ac:name="formName">myform</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="dc6d4e8e-a206-4c3c-8593-db4b741d7d29" ac:name="confiform-entry-register" ac:schema-version="1"> <ac:rich-text-body> <p> <br/> </p> </ac:rich-text-body> </ac:structured-macro> <p> <ac:structured-macro ac:macro-id="2c43ece0-0bc9-4942-a68b-41f0f4a7b4b1" ac:name="confiform-field-definition" ac:schema-version="1"> <ac:parameter ac:name="fieldName">eventTitle</ac:parameter> <ac:parameter ac:name="fieldLabel">Event title</ac:parameter> <ac:parameter ac:name="type">text</ac:parameter> </ac:structured-macro> </p> <p> <ac:structured-macro ac:macro-id="07050d93-1494-4a91-9ac3-f597641ff12b" ac:name="confiform-field-definition" ac:schema-version="1"> <ac:parameter ac:name="fieldName">eventDT</ac:parameter> <ac:parameter ac:name="fieldLabel">Event date/time</ac:parameter> <ac:parameter ac:name="type">datetimeinterval</ac:parameter> </ac:structured-macro> </p> <p> <ac:structured-macro ac:macro-id="720b12d8-9737-47f3-926b-8089db7ffe87" ac:name="confiform-field-definition-rules" ac:schema-version="1"> <ac:parameter ac:name="condition">(eventDT.startDate:<=[entry.eventDT.endDate] AND eventDT.endDate:>=[entry.eventDT.startDate] AND !id:[entry.id])</ac:parameter> <ac:parameter ac:name="fieldName">Dates overlap</ac:parameter> <ac:parameter ac:name="action">Validation rule dataset</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="7aa3b59e-ca84-474d-97a3-5b0a4a69cadb" ac:name="confiform-calendar" ac:schema-version="1"> <ac:parameter ac:name="eventTitleFieldName">[entry.eventTitle]</ac:parameter> <ac:parameter ac:name="groupingFieldName">eventDT</ac:parameter> <ac:parameter ac:name="formName">myform</ac:parameter> <ac:rich-text-body> <table class="wrapped"> <colgroup> <col/> </colgroup> <tbody> <tr> <td> <div class="content-wrapper"> <p> <ac:structured-macro ac:macro-id="921df724-5563-448e-b93c-ea221ae59e06" ac:name="confiform-field" ac:schema-version="1"> <ac:parameter ac:name="fieldName">eventTitle</ac:parameter> </ac:structured-macro> </p> </div> </td> </tr> <tr> <td> <div class="content-wrapper"> <p> <ac:structured-macro ac:macro-id="0858cddd-f7b2-41b9-a2b5-ab4caa795495" ac:name="confiform-field" ac:schema-version="1"> <ac:parameter ac:name="fieldName">eventDT</ac:parameter> </ac:structured-macro> </p> </div> </td> </tr> </tbody> </table> </ac:rich-text-body> </ac:structured-macro>