Unable to use page layout in templates for dynamically created pages by ConfiForms
Asked by Ralf Weidauer:

We use the page layout function to split a template page into four sections like

____________________________________________________________________________

\| upper left block \| upper right block \|

____________________________________________________________________________

\| lower left block \| lower right block \|

____________________________________________________________________________

If I use this template in confluence to create a new page it works allright.

If I use this template in ConfiForms the result is like

upper left block

upper right block

lower left block

lower right block

What's even worse, is that I cannot edit the newly created page. If I open it in editor it looks like

________________________________________________________________________________

\| \|

________________________________________________________________________________

If I add something and save the page only the added something is displayed and all of the contents of the blocks is lost.

Is this expected behaviour, did I run into a bug or have I made a mistake?


Answers:
author: Alex Medved _ConfiForms_
body: Hi

What do you have in your "templates"? Do you have ConfiForms Field macros without a "view" container or templates have the contents that is not related to ConfiForms?

Also, if you use page layouts on each template and want to combine them via ConfiForms then I dont think this will work. ConfiForms could do it for you, but Confluence (and I am pretty sure in that) will not understand the end result

Alex

comments: author: Ralf Weidauer
body: Hi Alex,

actually these templates are independent and they were created to be used in confluence. So far no specific ConfiForms stuff is included. It is intended to do so, but before waisting too much time I wanted to start with the existing templates first.

There would be manual work to do anyway after generating the pages. The main purpose is to guarantee a consistent structure, look and feel, contents, etc., for a certain issue having several (a lot indeed) instances.

I guess I could use a workaround using the "section" and "columns" macros (giving me even more control on the layout) (and it works with data fields from ConfiForms \[references to data stored there\], I tried that). It is only to earn more acceptance for the new process from the people originally building the templates, when they could (basically) use their own templates further on and when used in confluence directly, the well known format is kept.

To keep it short:

using confluence page layout feature in template (space tools/content tools/templates) pgLyoTemplate versus using section/columns-macros in template sctClmTemplate comes to

"IFTTT" - "CreatePage" with \[template.pgLyoTemplate\] -\> awful result

"IFTTT" - "CreatePage" with \[template.sctClmTemplate\] -\> great result

Well I guess I know what to do.

Thanks for your effort anyway.

Ralf.


author: Alex Medved _ConfiForms_
body: Well, let me try to explain why the things dont work the way you think they should and why there is no ConfiForms no blame here

As it does what is asked, but the result you get cannot be understood by Confluence

Consider something like this

![Screenshot 2022-11-14 at 09.21.48.png](https://community.atlassian.com/t5/image/serverpage/image-id/225492iCEE19E51AE73AB41/image-size/large?v=v2&px=999 "Screenshot 2022-11-14 at 09.21.48.png")

Which is represented by the following storage format

```
<ac:layout>
<ac:layout-section ac:type="two_equal">
<ac:layout-cell>
<p>Sec 1</p>
</ac:layout-cell>
<ac:layout-cell>
<p>Sec 2</p>
</ac:layout-cell>
</ac:layout-section>
</ac:layout>
```

Now, consider yet another template like the above, and then you ask BOTH templates to be used by ConfiForms to construct a page

Which will result into something like

```
?<ac:layout>
<ac:layout-section ac:type="two_equal">
<ac:layout-cell>
<p>Sec 1</p>
</ac:layout-cell>
<ac:layout-cell>
<p>Sec 2</p>
</ac:layout-cell>
</ac:layout-section>
</ac:layout>
<ac:layout>
<ac:layout-section ac:type="two_equal">
<ac:layout-cell>
<p>Sec 1</p>
</ac:layout-cell>
<ac:layout-cell>
<p>Sec 2</p>
</ac:layout-cell>
</ac:layout-section>
</ac:layout>
```

And this is where Confluence starts to struggle to understand what is this... as it is not designed to see multiple \<ac:layout\> nodes

I hope it is no clear what happens and why you cannot use multiple templates that use Confluence layouts to create ONE

Alex


author: Ralf Weidauer
body: I would really like to show you my storage format, yet since we migrated to data center this feature isn't available anymore (which I really, really regret).

I do not use TWO templates, it is only one.

Your example with one layout section and two layout cells would lead to

Sec1

Sec2

(where I hoped to see

Sec1 Sec2

)

Editing the page and save it would lead to

You see, you see nothing.

And this is the behaviour ONLY when using ConfiForms IFTTT to create a page, not when using confluence "Create" (and choosing the template).


author: Alex Medved _ConfiForms_
body: How does the **BODY** of the IFTTT macro that creates a page looks like?


author: Ralf Weidauer
body: \[template.myTemplate\]


author: Alex Medved _ConfiForms_
body: OK, here is the test - <http://recordit.co/FgRUJLRmnP>

Unless you have ConfiForms Field macros without a view then [no wrapping into a ListView will happen](https://wiki.vertuna.com/display/CONFIFORMS/Using+ConfiForms+app+as+template+engine+to+create+pages+in+Confluence#UsingConfiFormsappastemplateenginetocreatepagesinConfluence-WhyConfiForms%22auto-wraps%22everythingwithConfiFormsListViewonacreatedpage) and you should see exactly the result I see


author: Ralf Weidauer
body: Hell, I tried and tried, always the same result until I started the original ConfiForms page from the scratch. I simply deleted all the content and built it up again (manually). I tried every step and it worked. Using ConfiForms the result even showed a list view preserving the layout.

In the end I could identify the IFTTT macro to cause the issue. Yet I still cannot explain why. It looks exactly the same as my new one, but the old one failed and the new one works. Maybe one could find out the difference comparing the storage formats, but unfortunately I cannot do so (as mentioned before).

Is it possible that the body contained some invisible characters or somenthing like that?


author: Alex Medved _ConfiForms_
body: May be... but you can ask your administrators to share the storage format of the page with you - they should have access and there is no need for an extra plugin (btw, storage editor plugin for server works on DC - no problem;) )


author: Ulrik Schoth
body: Hi [@Ralf Weidauer](/t5/user/viewprofilepage/user-id/5043462)

I'm pretty sure I've had the same problems you describe. For this reason, a few weeks ago I added a warning as Instructional text to all templates used by ConfiForms (*Do not use Page Layouts in the template, otherwise ConfiForms will not work properly!*). My workaround was to use the Section and Column macros instead.

Now I wanted to take another look at the problem and to my great surprise, I have the impression that the problem is currently gone. The difference with my results back then is that I got them with ConfiForms version 2.27.30, but we have since updated to version 3.2.3.

[@Ralf Weidauer](/t5/user/viewprofilepage/user-id/5043462): Have you solved your problem in the meantime? If not: Which ConfiForms version do you currently use?

BTW: We use Confluence 7.13.11 Data Center.

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

The problem is not with a ConfiForms version, but with the template itself

If you template uses ConfiForms Field macros that are not inside the ConfiForms view macro (of any kind) then ConfiForms app will attempt to fix this error for you and will wrap the whole contents in a ListView macro, setting the filter to current record for the context

So, you should not have ConfiForms Field macros orphaned - they all should be in the views (that also included EntryViewer and Edit Controls macros)

Alex


author: Ralf Weidauer
body: HI [@Ulrik Schoth](/t5/user/viewprofilepage/user-id/2108520) ,

I am not able to reproduce the problem anymore. As Alex mentioned, when ConfiForms Field macros are put into ConfiForms view macros there hadn't been any problem at all. But actually now I can use anything I want, field macros inside/outside view macros, everything fine. Maybe due to a version upgrade? Don't know. Currently we're on Confluence 8.0.4 , yet I don't know anything about the last versions (when changed and so on).


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

I think that your assumption is not true in my case, because there were no ConfiForms macros in my template at all.

1. I had the task to create a template from an already existing page. *This page* *did not contain any ConfiForms macros*. However, page layouts were used.
2. To create the template, I copied/pasted the code shown in Source Editor from the page into the template.
3. A new page basing in this template was created with the ConfiForms IFTTT macro,
4. When I tried to open this page in Edit mode, Confluence was not able to load the page.

I found out that removing the page layouts in the template and replacing it by section/column macros solved the problem for me.

However, after updating to ConfiForms 3.2.3 in the meantime, I cannot reproduce the problems I had. With my post from yesterday I only wanted to give [@Ralf Weidauer](/t5/user/viewprofilepage/user-id/5043462) a hint to a potential solution.


author: Alex Medved _ConfiForms_
body: Could you share how does the created page looks like and what storage format does it have?

(the one that cannot be opened for editing)

Alex


author: Ulrik Schoth
body: Hi [@Ralf Weidauer](/t5/user/viewprofilepage/user-id/5043462), here is a hint about [how to see the currently used ConfiForms version](https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+FAQ#ConfiFormsFAQ-HowdoIseetheversionofConfiForms).


author: Ralf Weidauer
body: [@Ulrik Schoth](/t5/user/viewprofilepage/user-id/2108520)

3.2.3

Great. Seen that quite so often, but never really noticed.

Thanks.


author: Ulrik Schoth
body: Hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630)
> Could you share how does the created page looks like and what storage format does it have?

no, sorry. I did not keep any of the templates that did not work.

Unfortunately, I mistakenly thought that this was a limitation of ConfiForms and that I needed to find another solution. Namely using the Section/Column macros in this case.

Since neither [@Ralf Weidauer](/t5/user/viewprofilepage/user-id/5043462) nor I are able to reproduce the problem with version 3.2.3, I suggest to close this topic and to hope, that the problem has gone for good.


Tags: confiforms

confluence-server

server