Expand my Community achievements bar.

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

Using JavaScript with desgin time properties

Avatar

Level 1

Hi all,

I have a form with quite a few text fields. I would like to be able to update their captions programatically using JavaScript at design time.

I don't know how to address design time objects.

Any help would be highly appreciated.

Kamil

1 Accepted Solution

Avatar

Correct answer by
Level 10

At Design time you genrally cannot execute JavaScript in Designer.

The only option would be a macro, which requieres Designer ES2 or ADEP Designer.

A macro is a javascript file stored in a subfolder of Designers program folder, which can be executed at design time.

Here's a macro with a flex dialog I designed to manipulate fields at design time:

http://thelivecycle.blogspot.com/2011/06/field-designer-macro.html

http://2.bp.blogspot.com/-CpltoRPIl0E/Tm-5-5Ut-hI/AAAAAAAAAT0/CsYeMnwsFPc/s320/Dialog_v08_1.png

View solution in original post

3 Replies

Avatar

Former Community Member

Kamil,

Here is a sample for a text field with the fully-qualified name form1.page1.subform1.tf.

xfa.resolveNode("form1.page1.subform1.tf.caption.value.#text").value = "Favourite Soccer Team";

Sample attached. Note, it is possible to do bind captions to source data.

Steve

Avatar

Level 1

Hi Steve,

Thanks for taking the time to assisst me.

As I mentined before, I would like to change the caption in design view. This means that I want to start with:

CaptionBefore.JPG

and after running the script to end up with:

CaptionAfter.JPG

in Live Cycle Designer.

Hope it makes sense,

Kamil

Avatar

Correct answer by
Level 10

At Design time you genrally cannot execute JavaScript in Designer.

The only option would be a macro, which requieres Designer ES2 or ADEP Designer.

A macro is a javascript file stored in a subfolder of Designers program folder, which can be executed at design time.

Here's a macro with a flex dialog I designed to manipulate fields at design time:

http://thelivecycle.blogspot.com/2011/06/field-designer-macro.html

http://2.bp.blogspot.com/-CpltoRPIl0E/Tm-5-5Ut-hI/AAAAAAAAAT0/CsYeMnwsFPc/s320/Dialog_v08_1.png