Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Content Fragment - set the input fields through ajax call

ajayk62689618
Level 1
Level 1

Hi,

 

I have few input fields and created button(converted single line text to button) on content fragment.

When i click button on content fragment, the input fields are updated through ajax call response data, But when i am trying to save the updated values that is present in the input fields via default save button on the TOP is not updating to Content fragment.

 

If i edit any input fields in content fragment, then newly updated values are saved to content fragment via SAVE button on top.

 

Is there a way to customize the save action ?

 

Thank you.

AEM 6.4 content fragments
6 Replies
Suraj_Kamdi
Community Advisor
Community Advisor

@ajayk62689618 Can you please provide a sample code snippet or any screenshot related to your issue ? 

It will be really helpful to understand the issue.

ajayk62689618
Level 1
Level 1

Hello,

 

Please check the attached screenshot.

 

CF_error.JPG

 

1) User creates Content Fragment.

2) Open the Content Fragment

3) SourceType is pre-selected on content fragment load, Title, description etc are empty.

4) If user click on "Get Data" button, then AJAX call will trigger with pre-selected source type value as parameter and it returns json response data will be set to title, description etc.

5) After this, if we click on SAVE button at the top then new data which set through AJAX response are not storing in CRX.

 

But, After step 4 if user manually append/update any field then the SAVE button click is saving the latest data in CRX.

 

I think the content fragment edit session is not starting unless the user manually update any field in the content fragment.

https://docs.adobe.com/content/help/en/experience-manager-64/developing/extending-aem/customizing-co...

 

@Suraj_Kamdi @kautuk_sahni 

Can you guide me to start the edit session below steps through code after button click.

Starting a session
  • A new version of the content fragment is created.
  • Auto save is started.
  • Cookies are set; these define the currently edited fragment and that there is an edit session open.

https://docs.adobe.com/content/help/en/experience-manager-64/developing/extending-aem/customizing-co...

 

Thank you.

NehaCMS
Level 4
Level 4

Hi @ajayk62689618 @Suraj_Kamdi @kautuk_sahni - Wanted to check if it is possible to prepopulate a text field as readonly while creating a content fragment. For example Content Fragment A when I create should have value in field A as S1 and next content fragment i create should read already save content fragment property field A value and prepopulate content fragment B field A value as S2.

Suraj_Kamdi
Community Advisor
Community Advisor

@NehaCMS

No there is no such OOTB functionality to prepopulate the value for newly created content fragment.

NehaCMS
Level 4
Level 4

Thanks @Suraj_Kamdi for update above. As this is not available OOTB , can similar be customized. Any event that can be referred while opening content fragment and prepopulatingvalue.

cc:- @ajayk62689618 @kautuk_sahni