Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How to insert and delete fragments by clicking a button and how to script it?

Avatar

Former Community Member

I have a  question on livecycle. I am collecting the inventor information as a bunch of text fields, each asking for a certain details. Please see below

inventor.JPG

Now I have grouped them all in to one fragment called inventordetails and saved as .xdp file, so I could reuse this entire block. I want to add a button underneath this block, “ADD MORE INVENTORS” and when clicked this will insert another block and so forth and so on. However I was not sure as to how to insert and delete a fragment. Do  you think you can help with this? I appreciate any help in this regard.

Best

Subashini

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Replied with a solution in a private email.

paul

View solution in original post

6 Replies

Avatar

Former Community Member

When you reference your fragment in the mail form it will be placed in a subform container. It is that subform container that is referenced by the instance Manager to be able to add/delete subforms from it. The button woudl go on th email form and woudl reference the subform containing the fragment (like any other add/delete of a subform). Remember that the fragment gets resolved before render so from the form's perspective it is all one continuous XDP file.

Hope that helps

Paul

Avatar

Former Community Member

Thank you. But I am not sure I understand it very well. I am not very familiar with

this software. I want to know how to script those buttons to add and delete the fragments. Could you please

help me with this?

Thanks

Subashini

Avatar

Former Community Member

I woudl need to see the form and the fragment .....can you send them to LiveCycle8@gmail.com and include a description of what you are trying to do in the email and I will have a look when I can.

Paul

Avatar

Former Community Member

1.       I have a subform1 which is flowed

2.       I have subform2 inside subform1 which is positioned

3.       Inside subform2 I have two buttons 1. ADD INVENTOR 2. DELETE INVENTOR

4.       Also inside subform1 I insert a fragment called inventor

Now I want to script the buttons so that when clicked the inventor fragment either gets inserted again or deleted.

I greatly appreciate any help in this regard.

Best

Subashini

Avatar

Correct answer by
Former Community Member

Replied with a solution in a private email.

paul

Avatar

Former Community Member

Thank you so much Paul. It worked like a charm . I have another question about inserting watermark in the form. I am starting a new discussion thread . I would appreciate it if you could please answer it as well

Best

Subashini

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----