Node | Community
Skip to main content
Level 2
October 6, 2023
Solved

Node

  • October 6, 2023
  • 2 replies
  • 1244 views

When we use multifield it creates node on /content/{page}/jcr:content/{component}/node.
Basically creates node under component.

Is There a way without using multifield we can create node under /content/{page}/jcr:content/{component}/node.
Out Of The BOX.

Because for eg:- i  have component which use 2 buttons 1> PrimaryButton . 2> SecondaryButton
as both are button they will have same props.

Is there a way without multifield i can create  node like this under the component.
/content/{page}/jcr:content/{component}/
                                                                +{primarybutton}
                                                                +{secondarybutton}

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by user06615

i got one more solution Using
cq:include also we can achieve.
using namespace

this way we will not have create nodes again
@sherinregi-1 

 

2 replies

ksh_ingole7
Community Advisor
Community Advisor
October 6, 2023

Hey @user06615 

 

In Coral 3 Multifield the node is created for each multifield item added. May I know the exact use case for which you need 2 nodes for primaryButton and secondaryButton to be displayed under the component. 

 

user06615Author
Level 2
October 6, 2023

Hi @ksh_ingole7 if i use multifield.
I will have to use List<Button> to consume data.

But i want to consume under primaryButton, secondaryButton objects.

sherinregi-1
Community Advisor
Community Advisor
October 6, 2023

Hi @user06615 

If you want to create under the component node you can try the below syntax in the component dialog .But one catch is you will have to define the properties for both the buttons as its not shared 

 

<primarybutton
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="button Text"
name="./primarybutton/ctaText"/>

<secondarybutton
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="button Text"
name="./secondarybutton/ctaText"/>
user06615Author
Level 2
October 6, 2023

Thanks @sherinregi-1 let me try.