Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Playground and DEMO space

This is a playground and demo space for ConfiForms and ConfiDoc addons developed and supported by Vertuna LLC

Most pages provide a storage format for the demo, so you can use the free add-on from Atlassian Confluence Source Editor to import this configuration into your Confluence and see it in action

To import examples from the storage format on Confluence Cloud please see this page

Please note, all the examples here are provided without any obligation and may or may not be incomplete or may have bugs, and we provide NO SUPPORT for these examples and demos.


We have a table with the following structure in our database

create table cf_copy_2_db_demo (id SERIAL, name varchar(100), name2 varchar(50), confi_id_ref varchar(40));

And would like to copy the data from our form to this table

Our form has 2 fields, title and area, which will be copied to fields name and name2 in the database

We have handlers for 3 events in ConfiForms - "oncreated",  "onmodified" and for "ondeleted"



Source code for the solution

<ac:structured-macro ac:macro-id="54b51504-c3a5-481a-b8ae-16c04b500104" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f1</ac:parameter>
  <ac:rich-text-body>
    <p>
      <br/>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="091deb8c-54c8-410b-b9cd-fb453c32f059" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">title</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Title</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="e5971607-5ec9-4451-9c92-bd40d9184ab4" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">area</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Area</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="30589a64-22ea-4678-a71c-f994f207c47c" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">title.asLength:&gt;100</ac:parameter>
        <ac:parameter ac:name="fieldName">Title is too long, shall be less than 100 symbols</ac:parameter>
        <ac:parameter ac:name="action">Validation rule</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="9ce1210d-4898-4203-89e6-0336d2b41679" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">area.asLength:&gt;50</ac:parameter>
        <ac:parameter ac:name="fieldName">Area is too long, shall be less than 50 symbols</ac:parameter>
        <ac:parameter ac:name="action">Validation rule</ac:parameter>
      </ac:structured-macro>
    </p>
    <ac:structured-macro ac:macro-id="e769fd3d-8d27-451c-ba1a-ccf4e4d32305" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="action">Copy ConfiForms Data to DB</ac:parameter>
      <ac:parameter ac:name="extras">7422036e-9a6f-4455-92d9-7140131fb9da</ac:parameter>
      <ac:parameter ac:name="event">onCreated</ac:parameter>
      <ac:parameter ac:name="title">INSERT INTO cf_copy_2_db_demo(name, name2,  confi_id_ref) VALUES('[entry.title]', '[entry.area]', '[entry.id]')</ac:parameter>
      <ac:parameter ac:name="extras2">id:[entry.id]</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="5b4f5b76-a473-4fc0-ae47-e8dc163d6069" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="action">Copy ConfiForms Data to DB</ac:parameter>
      <ac:parameter ac:name="extras">7422036e-9a6f-4455-92d9-7140131fb9da</ac:parameter>
      <ac:parameter ac:name="event">onModified</ac:parameter>
      <ac:parameter ac:name="title">UPDATE cf_copy_2_db_demo SET name = '[entry.title]', name2 = '[entry.area]' WHERE confi_id_ref = '[entry.id]'</ac:parameter>
      <ac:parameter ac:name="extras2">id:[entry.id]</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="1704150b-583b-48fe-ac73-1dc45c4fc4b2" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="action">Copy ConfiForms Data to DB</ac:parameter>
      <ac:parameter ac:name="extras">7422036e-9a6f-4455-92d9-7140131fb9da</ac:parameter>
      <ac:parameter ac:name="event">onDeleted</ac:parameter>
      <ac:parameter ac:name="title">DELETE FROM cf_copy_2_db_demo WHERE confi_id_ref =  '[entry.id]'</ac:parameter>
      <ac:parameter ac:name="extras2">id:[entry.id]</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
  </ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="4bba00e4-cbbe-4006-9203-120fdd3d3f90" ac:name="confiform-entry-register" ac:schema-version="1">
  <ac:parameter ac:name="formName">f1</ac:parameter>
  <ac:parameter ac:name="embedded">true</ac:parameter>
  <ac:rich-text-body>
    <p>
      <br/>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
  • No labels