Highlighted

Unable to save a multifield value as a page property

ranganathanc

15-01-2018

Hi there,

I wanted to add a page property while creating a new page and below is my partial code of dialog.xml

<blogAuthor
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
   class="multifield-full-width"
   fieldLabel="Blog Authors"
   cq:showOnCreate="true">

         <field
                  jcr:primaryType="nt:unstructured"
                  sling:resourceType="granite/ui/components/coral/foundation/form/select"
                  fieldLabel="Blog Author"
                  class="multifield-full-width"
                  name="./blogAuthor">

                       <datasource
                            jcr:primaryType="nt:unstructured"
                            sling:resourceType="project/components/content/author-datasource"
                            name="datasource"/>

        </field>

</blogAuthor>

This is the output of page creation

Screen Shot 2018-01-15 at 1.35.16 PM.png

Screen Shot 2018-01-15 at 2.04.28 PM.png

I even added the typehint so that the parameter is stored as an array.

<blogAuthor_TypeHint
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/hidden"
   name="./blogAuthor@TypeHint"
   ignoreData="true"
   value="String[]"/>

smacdonald2008 any help on this?

Replies

Highlighted
Highlighted

ranganathanc

15-01-2018

But if that's the case then it should throw me an error when I am editing the page too! But it works fine when I am a editing the page. Only during page creation, there is some issue. Something related to POST servlet?

Highlighted

edubey

16-01-2018

You can refer to the OOTB implementation of vanity URL in Basic tab

/libs/foundation/components/page/cq:dialog/content/items/tabs/items/basic/items/column/items/vanityurl/items/vanitypath

Isn't it similar to your usecase, or am I missing something here?

Highlighted

ranganathanc

16-01-2018

edubey

If you see that vanity url's are not set during the page creation, It can be set only during page edit. So I get this error in the multifield only during page creation, while editing the page it works fine!