ConfiForms via Excerpt Include - Is there a solution for this?
Asked by Ulrik Schoth:

I have a ConfiForms form that is used to create another page using the IFTTT macro. The new page also contains a ConfiForms form (see example code 1).

In my use case, my users have a) to create a new page, b) to fill out the form on the new page and c) to add text and graphics information using the edit mode of Confluence. I would like to avoid that they see all ConfiForms macros if they edit the page (they may get irritated by the bunch of macros or they may delete them by accident).

Therefore I have moved all ConfiForms macros inside the IFTTT macro to a third page ("module page") and used an Excerpt macro there. Then I placed an Excerpt Include macro inside the IFTTT macro to include the module page (see example code 2 and 3).

Unfortunately this does not work: Created records on new pages seem to be assigned to the module page. Each new page shows all records of all pages that have created before. (Instead of showing just the records that were created by a certain page.)

* Is this behaviour by design and there is no solution for this use case?
* Or did I do anything wrong?

Example code 1:

```
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="da6051b9-f560-4fb5-809d-7be858bf474f" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">f</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="915087d3-63bd-4b31-9e3e-36e84496a173" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="presetValues">p=[entry._page]</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="71394339-b7c8-4d1a-bd4d-5f394fb028e7" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">p</ac:parameter>
<ac:parameter ac:name="fieldLabel">p</ac:parameter>
<ac:parameter ac:name="type">page</ac:parameter>
</ac:structured-macro>
</p>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="eeb1beac-ade5-4cfb-9500-8de727cae54c" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">t</ac:parameter>
<ac:parameter ac:name="fieldLabel">t</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="8c4b8271-0333-4948-a8f7-6b6e025285b6" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">Create Page</ac:parameter>
<ac:parameter ac:name="extras">[entry.p]</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">[entry.t]</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="ae720479-bf08-4549-bb47-8d93b1cd8480" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">f2</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="a6d83aa5-9276-4daa-8de3-e78e47878ee6" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">f2</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="b8a7f920-7759-499c-8036-bd9ef599faf7" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="d2cff2ba-6e00-492c-b975-1f15d4a9979e" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">e1</ac:parameter>
<ac:parameter ac:name="fieldLabel">e1</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="829ce07a-8799-4464-8107-eef89601283a" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">e2</ac:parameter>
<ac:parameter ac:name="fieldLabel">e2</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p class="auto-cursor-target">
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">... Here the user has to add information (text, graphics) in edit mode. ...</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="723be9a5-0e48-4d7a-be39-3295c8821727" ac:name="children" ac:schema-version="2"/>
</p>
```

Example code 2:

```
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="da6051b9-f560-4fb5-809d-7be858bf474f" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">f</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="915087d3-63bd-4b31-9e3e-36e84496a173" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="presetValues">p=[entry._page]</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="71394339-b7c8-4d1a-bd4d-5f394fb028e7" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">p</ac:parameter>
<ac:parameter ac:name="fieldLabel">p</ac:parameter>
<ac:parameter ac:name="type">page</ac:parameter>
</ac:structured-macro>
</p>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="eeb1beac-ade5-4cfb-9500-8de727cae54c" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">t</ac:parameter>
<ac:parameter ac:name="fieldLabel">t</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="8c4b8271-0333-4948-a8f7-6b6e025285b6" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">Create Page</ac:parameter>
<ac:parameter ac:name="extras">[entry.p]</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">[entry.t]</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="4393c5a1-e810-451e-8703-2fb4cab1140d" ac:name="excerpt-include" ac:schema-version="1">
<ac:parameter ac:name="nopanel">true</ac:parameter>
<ac:parameter ac:name="">
<ac:link>
<ri:page ri:content-title="ConfiForms module"/>
</ac:link>
</ac:parameter>
</ac:structured-macro>
</p>
<p class="auto-cursor-target">... Here the user has to add information (text, graphics) in edit mode. ...</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="723be9a5-0e48-4d7a-be39-3295c8821727" ac:name="children" ac:schema-version="2"/>
</p>
```

Example code 3 (module page):

```
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="e434c9e6-aca3-4cb7-9d2b-b0377f4e8f56" ac:name="excerpt" ac:schema-version="1">
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="ae720479-bf08-4549-bb47-8d93b1cd8480" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">f2</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="a6d83aa5-9276-4daa-8de3-e78e47878ee6" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">f2</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="b8a7f920-7759-499c-8036-bd9ef599faf7" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="d2cff2ba-6e00-492c-b975-1f15d4a9979e" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">e1</ac:parameter>
<ac:parameter ac:name="fieldLabel">e1</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="829ce07a-8799-4464-8107-eef89601283a" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">e2</ac:parameter>
<ac:parameter ac:name="fieldLabel">e2</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p class="auto-cursor-target">
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
```


Answers:
author: Alex Medved _ConfiForms_
body: Hi

Not sure how to use the examples and what are you trying to illustrate, but I can tell you that the exerpt/excerpt include macros are rendered on the source page. Which means they have the same rendering context, no matter where you use them

In other words - this macro works like this "include rendered content from a page", and not like "include source and render"

Alex


author: Ulrik Schoth
body: Hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) ,

thanks for your answer. Since I was not absolutely sure if the usage of virtual functions like "asEntryRef" or "asRef" in the ConfiForms macros might help, I just wanted to give the option to check the code I've used. Perhaps that was a bit of an exaggeration...

Anyway, your answer confirms my impression that there is no solution for my use case.

Best regards  
Ulrik

comments: author: Alex Medved _ConfiForms_
body: Restrict edit permissions on the page - that is what you need to do anyway (to keep the form and data secure)

What you want to achieve is possible either with live template (adaptavist macro) / smart confitemplate (our templates macro) or a custom user macro


Tags: confiforms

confluence-cloud

server