Page tree
Skip to end of metadata
Go to start of metadata

This is the documentation for ConfiForms Server/Data Center app


In this tutorial we will show you how to use validation rule across different forms (we will have 3 in our setup) and ensure the user is registered only once.

If you are new to ConfiForms, please take a few minutes to read the Basic concepts Guide, or go through the video tutorial on that page.  (smile)

For simplicity we will have all our forms configured on one page and to be identical (only the form name differs)

This is not a limitation to have the identical forms, and only done to simplify the tutorial

 

All forms have just one field and a number of validation rules (configured using the ConfiForms Field Definition Rules macro)

And look lik ethis in edit mode

You can see the 3 rules we have setup

They all fire when record is new (ID is empty, id:[empty])

All 3 rules are very similar (the storage format for the first form looks like this)

<ac:structured-macro ac:macro-id="75ff1a2d-ab42-4764-bfff-14e9684d6684" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f1</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="46843f98-9441-4b0f-abd1-477cf29a05a6" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:rich-text-body>
        <p> </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p>
      <ac:structured-macro ac:macro-id="4a7b155b-3c11-4344-8356-c79df3586ddc" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">somefield</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Some field</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="fac2b9d2-aa17-4735-9579-7961d6586965" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">id:[empty]</ac:parameter>
        <ac:parameter ac:name="fieldName">Hei, you are already registered</ac:parameter>
        <ac:parameter ac:name="values">createdBy:this</ac:parameter>
        <ac:parameter ac:name="action">Validate if exists in other Form</ac:parameter>
        <ac:parameter ac:name="values2">f2:9371728</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="edef8427-03a4-4d10-99b0-6293d45cb4b0" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">id:[empty]</ac:parameter>
        <ac:parameter ac:name="fieldName">Hei, you are already registered</ac:parameter>
        <ac:parameter ac:name="values">createdBy:this</ac:parameter>
        <ac:parameter ac:name="action">Validate if exists in other Form</ac:parameter>
        <ac:parameter ac:name="values2">f3:9371728</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="5b4bea97-4c4b-4f1b-abd5-4506a4028824" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">id:[empty]</ac:parameter>
        <ac:parameter ac:name="fieldName">Hei, you are already registered</ac:parameter>
        <ac:parameter ac:name="values">createdBy:this</ac:parameter>
        <ac:parameter ac:name="action">Validate if exists in other Form</ac:parameter>
        <ac:parameter ac:name="values2">f1:9371728</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>

Let's take a look at how the rules are setup in macro editor

same macro configuration continues

We look/filter records in a different form based by "createdBy" metadata field and asking to use "this", a current user

(same macro configuration continues)

And the last parameter tell the validation rule which form to use and wher eit is located (expects form name and pageId of the page where the form is located)

Other 2 rules are the same, with one difference: they check different forms, in our setup a form called "f3" and records in own form "f1" (as we dont want duplicates in current form also)

 

Basically, every form has the same set of rules and here is teh complete storage format

 Click here to expand...
<ac:structured-macro ac:macro-id="75ff1a2d-ab42-4764-bfff-14e9684d6684" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f1</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="9bd353bb-0fbb-431d-9035-a7344fb62f66" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:rich-text-body>
        <p> </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p>
      <ac:structured-macro ac:macro-id="50bf170d-49f8-4d46-b969-33a4968cf777" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">somefield</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Some field</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="3c7e1426-2d04-4119-9015-bba30fbf52a9" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">id:[empty]</ac:parameter>
        <ac:parameter ac:name="fieldName">Hei, you are already registered</ac:parameter>
        <ac:parameter ac:name="values">createdBy:this</ac:parameter>
        <ac:parameter ac:name="action">Validate if exists in other Form</ac:parameter>
        <ac:parameter ac:name="values2">f2:9371728</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="88a4a81a-6fef-4987-84cc-53378bab7585" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">id:[empty]</ac:parameter>
        <ac:parameter ac:name="fieldName">Hei, you are already registered</ac:parameter>
        <ac:parameter ac:name="values">createdBy:this</ac:parameter>
        <ac:parameter ac:name="action">Validate if exists in other Form</ac:parameter>
        <ac:parameter ac:name="values2">f3:9371728</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="639aa3d7-dfad-4e94-b711-0d094dd472f9" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">id:[empty]</ac:parameter>
        <ac:parameter ac:name="fieldName">Hei, you are already registered</ac:parameter>
        <ac:parameter ac:name="values">createdBy:this</ac:parameter>
        <ac:parameter ac:name="action">Validate if exists in other Form</ac:parameter>
        <ac:parameter ac:name="values2">f1:9371728</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="60523792-0e9d-4d3c-8891-66d0fed72494" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f2</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="bcbb7fb8-0c10-4e87-8393-d179270a9517" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:rich-text-body>
        <p> </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p>
      <ac:structured-macro ac:macro-id="c46de065-b599-4c4f-a2e5-a233b2c972e1" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">somefield</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Some field</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="0e0cdde3-67e7-4d0d-a97e-5055c01ed0c7" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">id:[empty]</ac:parameter>
        <ac:parameter ac:name="fieldName">Hei, you are already registered</ac:parameter>
        <ac:parameter ac:name="values">createdBy:this</ac:parameter>
        <ac:parameter ac:name="action">Validate if exists in other Form</ac:parameter>
        <ac:parameter ac:name="values2">f1:9371728</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="3266e270-dd38-481a-8b11-3fdc57c7f76b" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">id:[empty]</ac:parameter>
        <ac:parameter ac:name="fieldName">Hei, you are already registered</ac:parameter>
        <ac:parameter ac:name="values">createdBy:this</ac:parameter>
        <ac:parameter ac:name="action">Validate if exists in other Form</ac:parameter>
        <ac:parameter ac:name="values2">f3:9371728</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="76905091-e47e-4939-95a0-cdc0f966dc54" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">id:[empty]</ac:parameter>
        <ac:parameter ac:name="fieldName">Hei, you are already registered</ac:parameter>
        <ac:parameter ac:name="values">createdBy:this</ac:parameter>
        <ac:parameter ac:name="action">Validate if exists in other Form</ac:parameter>
        <ac:parameter ac:name="values2">f2:9371728</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="81192d9c-74e0-40d2-be55-eb5164287026" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f3</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="f6a2b180-c267-44c6-aba2-5345f4e5e348" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:rich-text-body>
        <p> </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p>
      <ac:structured-macro ac:macro-id="d94f1c50-952f-4df8-a941-1cf7d4804762" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">somefield</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Some field</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="7ddcb99d-0ca5-4f39-acba-7ee23f0eaff1" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">id:[empty]</ac:parameter>
        <ac:parameter ac:name="fieldName">Hei, you are already registered</ac:parameter>
        <ac:parameter ac:name="values">createdBy:this</ac:parameter>
        <ac:parameter ac:name="action">Validate if exists in other Form</ac:parameter>
        <ac:parameter ac:name="values2">f2:9371728</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="a397268b-a102-4f3a-9427-e4cfac42f1ad" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">id:[empty]</ac:parameter>
        <ac:parameter ac:name="fieldName">Hei, you are already registered</ac:parameter>
        <ac:parameter ac:name="values">createdBy:this</ac:parameter>
        <ac:parameter ac:name="action">Validate if exists in other Form</ac:parameter>
        <ac:parameter ac:name="values2">f1:9371728</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="3e6ab602-20da-41fc-8ae7-acd3846083fc" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">id:[empty]</ac:parameter>
        <ac:parameter ac:name="fieldName">Hei, you are already registered</ac:parameter>
        <ac:parameter ac:name="values">createdBy:this</ac:parameter>
        <ac:parameter ac:name="action">Validate if exists in other Form</ac:parameter>
        <ac:parameter ac:name="values2">f3:9371728</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>

you will need to change the page ID in every rule (we have it on page "9371728", you page id will certainly be different)

 

And the end result looks something like this (even if the registration is actually in some other form):

We see this can be used with some master forms where a user can enable/disable registration by setting some values and then "child" pages, on registrations will chekc the master form to see if registrations are allowed.

Or used exactly the way describved in this tutorial - having multiple registration forms but ensuring the registrations are unique by user or some other criteria, which you can describe via the filter

 

 

 

  • No labels