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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Is it possible for fragments to contain variable content?


Level 4

Hi everyone,

I've been looking at using fragments to help with maintaining form consistancy. We have about 25 forms which all use the same template. Our company just changed our slogan, which is included in the footer of the master page. Now I find myself having to go through all 25 forms to update the slogan. This sounds like a perfect job for fragments.

I would like to have one fragment for the entire header, and a second fragment for the entire footer. My issue is that each form has a different title in it's header, and a different document reference number in the footer. Idealy, I would like to be able to set up variables associated with my fragment, then use some javascript to update the fragment content.

A part of me thinks that this goes against the very nature of fragments... but I wanted to ask to be certain. It would just be so much cleaner than the alternative... I could, for example, just include the static text that will be the same across all forms, and leave variable content outside of the fragment (but still a part of the template). That way, if I ever had to change to logo, I could, but I would still be able to manually specify a title and document number.

My only concern with the above is; what if I am asked to change the font of the title in all forms. If I could somehow use a fragment, it would be very easy. I know that we have about 120 forms planned... I would hate to have to update each individually if it was something I could avoid.

Thanks for your help!

Bonus Question:

Is there a faster way to batch 'refresh' an updated fragment than to open each form in Livecycle Designer and resave? True, it's a lot faster than manually making the changes to each form, but it would still be nice not to have to open each form to update them.

0 Replies


Level 4

Well, as I was writing the above question, I had an idea as to how I mihgt be able to acheive this... I tried it and it worked.

In my master page, I he turned my entier header into a fragment. In the header is an empty text field that I have formatted to look as I want the title text to appear. Also in my master page is a "FormOptions" subform with text fields for each 'variable' such as title.

In the Title text field in the fragment, in the initialize code I've used:

this.rawValue = FormSettings.Title.rawValue;

this.access = "readOnly";

Now, when I create a new form, I can set the default values of the 'variable' text boxed to the appropriate values, then hide the "FormOptions" subform from view by setting it to invisible. I haven't had much of a chance to test, but it looks to work well. I've also mathe "FormOptions" subform and it's child fields to have no data binding, so that the exportable xml of the form doesn't get cluttered up.

If anyone can think of a less convoluted method, I'd still love to hear it. I am also still interested in hearing about fater ways to updated multiple forms when I edit a fragment.