ConfiForms working with Page/Blogpost, but doesnt work when trying to use multi-select field type
Asked by Kevin Kott:

I am trying to use page/blogpost field type with the pageProperties virtual function to pull page properties and store them in a list. I am able to get what I am trying to do accomplished when using the Page/Blogpost field type, but I am trying to allow the user to link multiple pages as a time, and then it store a list of all the page properties from the linked pages.

I am running into 2 issues when switching the multi-select field type.

1. Even when I choose the field name to monitor is the multi-select field, it doesn't update the form when pages are selected. I have to choose another field to track so that it updates.

2. The ConfiForms code fails entirely. Even when I have a second field type tracked the page properties virtual function doesn't pull any data from the linked pages.

I am not sure what I am doing wrong. I see that the regular page/blogpost field type stores the pageid, so I tried to get a list of pageids from the multi-select, but even passing that doesn't result in any page property data. I wonder if I am not getting the pageids in the right format.


Answers:
author: Alex Medved _ConfiForms_
body: Hi [@Kevin Kott](/t5/user/viewprofilepage/user-id/5580659)

Sounds very complicated to me, but what I can say is that the pageProperties function can be used on a page object, and not on the array of page objects

Alex

comments: author: Kevin Kott
body: It's not that complicated. All I am trying to do is get a list of page property values from multiple pages. That is, user selects a list of pages using the multi-select field, and then new fields store the lists of page property A, page property B, and so on. This is to determine what page properties pertain the certain document that is trying to be created.  

So, propA would store the values of all page properties A as a list. propB would store the values of all page properties B as a list, from the pages the user selects. If there is a better way to grab this info, I am all ears.

<br />

I'm currently trying to see if I can step through a .get(i) virtual function as I can grab page properties one at a time via this method. Unfortunate, but a solution is needed.


author: Alex Medved _ConfiForms_
body: Very complicated to my taste, but happy to share what I can...

Little demo with a storage format included below

[https://wiki.vertuna.com/download/attachments/178782502/Community%20-%20ConfiForms%20working%20with%20Page%3ABlogpost%2C%20but%20doesnt%20work%20when%20trying%20to%20use%20multi-select%20field%20type.mov?version=1\&amp;modificationDate=1725622299351\&amp;api=v2](https://wiki.vertuna.com/download/attachments/178782502/Community%20-%20ConfiForms%20working%20with%20Page%3ABlogpost%2C%20but%20doesnt%20work%20when%20trying%20to%20use%20multi-select%20field%20type.mov?version=1&amp;modificationDate=1725622299351&amp;api=v2)

Configuration

```
<ac:structured-macro ac:name="confiform" ac:schema-version="1" ac:macro-id="8edcc50f-3dbb-4b07-9edb-cf368d166df8"><ac:parameter ac:name="formName">form</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-entry-register" ac:schema-version="1" ac:macro-id="939eaf2a-889a-4159-a00a-cfb045c5b28c"><ac:rich-text-body><p><br /></p></ac:rich-text-body></ac:structured-macro><p><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" ac:macro-id="3772fdd2-7c6e-4492-81a2-0147f5edea46"><ac:parameter ac:name="fieldName">pages</ac:parameter><ac:parameter ac:name="fieldLabel">Pages</ac:parameter><ac:parameter ac:name="type">multipage</ac:parameter></ac:structured-macro></p></ac:rich-text-body></ac:structured-macro><p><br /></p><ac:structured-macro ac:name="confiform-card" ac:schema-version="1" ac:macro-id="5e1f0628-6090-4181-b9ec-9e36ce516175"><ac:parameter ac:name="formName">form</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-entry-edit" ac:schema-version="1" ac:macro-id="068210a5-e025-485a-a282-c04230f9f701"><ac:rich-text-body><p><br /></p></ac:rich-text-body></ac:structured-macro><p><ac:structured-macro ac:name="confiform-field" ac:schema-version="1" ac:macro-id="4ae11c49-4910-4f24-a0b3-c0cf87e48a7e"><ac:parameter ac:name="fieldName">pages</ac:parameter></ac:structured-macro></p><p><ac:structured-macro ac:name="confiform-field" ac:schema-version="1" ac:macro-id="d729f8a1-bbd5-4ef0-b42a-2918b96a42a7"><ac:parameter ac:name="overrideLabel">Page properties prop1</ac:parameter><ac:parameter ac:name="fieldName">pages.iterateAndPrint([entry.id] - [entry.id.asPage.title] - [entry.pageProperties(Prop1).append(&lt;br/&gt;)])</ac:parameter></ac:structured-macro></p><p><ac:structured-macro ac:name="confiform-field" ac:schema-version="1" ac:macro-id="0ea91138-a800-4a64-a13f-dc9d4312a04b"><ac:parameter ac:name="overrideLabel">Page properties prop2</ac:parameter><ac:parameter ac:name="fieldName">pages.iterateAndPrint([entry.id] - [entry.id.asPage.title] - [entry.pageProperties(Prop2).append(&lt;br/&gt;)])</ac:parameter></ac:structured-macro></p></ac:rich-text-body></ac:structured-macro><p><br /></p><p><br /></p><p><ac:structured-macro ac:name="children" ac:schema-version="2" ac:macro-id="6a09d7fc-04c6-485e-b3d5-9f925b10afc7" /></p>
```

Hope it helps someway or another

Alex


author: Kevin Kott
body: This helped a whole lot! It seems I was missing the iterateAndPrint virtual function within my field definitions. I have been able to get everything working now. Thanks!


Tags: addon-com.vertuna.confluence.plugins.confiforms

confiforms

confluence-data-center

data-center