Static Text + Prefill

fir89 21-01-2018

I am using AEM Form 6.3. Currently, the inputs are pre-filled as described in the article with a JSON schema (Adobe Experience Manager Help | Prefill adaptive form fields ). It all works.

However, I would like to pre-populate a static text as well. The static text component has been set via "Bind Reference" as well. But the value from the incoming JSON was not displayed on it. It only displays the default value of "The text will appear here". I am trying not to use textbox as the static text has the ability to wrap itself with the href attribute, which is required in my use case as well.

Is there a way to get it to display the value from my JSON? Or is there an alternative?

Accepted Solutions (1)

Accepted Solutions (1)

jagjeetthukral 07-02-2018

So, I guess final correct answer should be add below mentioned code to code editor on initialize:

guideBridge.on("bridgeInitializeComplete", function (event, data) {

   guideBridge.resolveNode("staticText1").value = "Your new static text here";


I have created a blog post which delves into details around how to dynamically change static text

smacdonald2008​ : I think we should change the correct answer, as the answer which is currently marked correct answer, will never work in this question's use-case, Prefill Scenario. It will confuse other readers in its current state.



AEM Forms Blog

Answers (7)

Answers (7)

jagjeetthukral 06-02-2018

Yes James. I wanted to write bridgeInitializeComplete.

But the point I wanted to make is, the suggestion you made in the previous comment which says to use  staticText1.value = "Test text"; won't work from initialize script (for prefill) from Form's Rule editor.

PFB The screenshots for the same, static text remains unchanged even after script.

Screen Shot 2018-02-06 at 9.41.30 PM.png

Screen Shot 2018-02-06 at 9.42.04 PM.png

Please let me know, if I am doing something wrong.

My suggestion to the original problem will be to call static Text value change after guideBridge has been completely initialized, which can be written in a client lib file.



AEM Forms Blog

jagjeetthukral 06-02-2018

Hi fir89/James R Green,

There is another caveat with James answer. I haven't ever been able to get this thing working with initialize of AEM Form (maybe I am missing some trick here). As far as I know, This particular thing only works after the complete DOM is loaded.

Since you want something where the text should be prefilled on load of form, I suppose this won't work. What you will have to do instead is you will have to fire this particular piece of code once the complete form is loaded. You may do this by  adding a listener like

window.addEventListener("bridgeInitializeStart", function(evnt) {
     // get hold of the guideBridge object
     var gb = evnt.detail.guideBridge;

     gb.resolveNode("staticText1").value = "abc";


James R Green​ : Please let me know if I am missing a trick and this works on initialize.


Jagjeet Singh

AEM Forms Blog

James_R_Green 06-02-2018

Hi jagjeetthukral​,

Right I see - thanks for pointing that out! The test I performed from the rules editor was actually from a button press. Setting from rules editor on init in forms editor doesn't seem to work for static text (unlike for textboxes). So yes to init the static text fields it looks like it needs to be done after guide bridge has initialised or on an event such as a click of a button. Screenshot of my tests below for reference:


Set from rules editor with the name of the fields.value (or this.value) and from clientlib as described by Jagjeet:

gb.on("bridgeInitializeComplete", function (event, data) {

   gb.resolveNode("text4").value = "text4 set from clientlib";

   gb.resolveNode("textbox4").value = "textbox4 set from clientlib";


James_R_Green 28-01-2018

You can set the value of the static text from javascript either in the rules editor or a client library referring to it by Element Name e.g.

staticText1.value = "Test text";

You could of course source the text in this example from a JSON object. Does that help?

Also worth noting that the rules editor needs to be in code editor mode, the visual editor doesn't allow you to set the value of static text items.