Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Script fragments

Avatar

Level 2

I created a script fragment that will contain common variables and functions that I want to be used in various different forms. When I place the fragment on a new form all the scripting becomes disabled for the entire form even for subforms that have nothing to do with the scripting fragment. I want to still be able to edit the scripting for other objects on the form. How can this be done?

4 Replies

Avatar

Level 10

Fragments are meant to be non-editable in the all forms other than the "Source file (XDP)" which holds the source code for Fragment.

You can only change it at one place. Usually they are used to place Header and Footer information across the forms in a company. So when there is a change in the Header/ Footer info, you can update them at only one place so the changes will be reflected in all the "child" forms that utilize the fragment.

Probably in your case, you can try looking at using the Script Object which you can copy and paste in other form and make changes as necessary..

Thanks

Srini

Avatar

Level 2

Thanks. I'm not looking at editing the fragment on the new form itself. I just want to be able to edit the script for other objects on that form, but once a fragment is placed on the form EVERYTHING is disabled.

I was hoping to make this more of a reusable piece of code that if changes were made to the script fragment, I would only have to make the change on the fragment and the other forms referencing the fragment would not need to be modified and receive the script changes or additions.

If I have the script object on each form I would have to make sure to copy and paste the changes on every form.

I don't understand why the scripting for the entire form gets disabled as these script fragments can simply be used like javascript files that should be considered like include files. Common functions that can be used across multiple forms. Edit the source script and all forms get the change.

Avatar

Level 10

Sorry. I missed the point that the whole form got disabled..I was thinking you were asking why the Fragment code is disabled..

I did a small test again and I could able to change the form objects scripts..Not sure how to recreate your issue..

Here is the sample I tested..

https://acrobat.com/#d=ANkhwb6yiWZpDysFj5qeRw

If you can able to send the fragment and form to LiveCycle9@gmail.com I can have a look at it..

Thanks

Srini

Avatar

Level 2

Srini,

I viewed your sample and tried adding the script fragment to my new form again. What happens is that when it first add the script fragment and I click on the top-level form in the hierarchy everything in the script looks disabled (greyed-out). I click around a few more times and now everything looks to be okay. Weird.

Thanks again for your response and help.

Mike