Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Referencing XML data within the form

Avatar

Level 2

When I view the XML source of my form I see the following lines:

      <desc>
         <text name="version">1.1</text>
         <text name="creator">Al Clawson</text>
         <text name="issued">2/3/2011</text>
         <text name="created">2/1/2011</text>
      </desc>

There is any way I can refer to these strings in calculated fields?  Specifically I want a small text field in the footer that displays the version of the form being used at the moment.

1 Accepted Solution

Avatar

Correct answer by
Level 7

Looking at the XML, the logical reference is: form1.desc.version

form1.desc.version               //FormCalc it works!

View solution in original post

6 Replies

Avatar

Correct answer by
Level 7

Looking at the XML, the logical reference is: form1.desc.version

form1.desc.version               //FormCalc it works!

Avatar

Level 7

this = form1.desc.version;   //JavaScript also!


Avatar

Level 2

And in today's lesson I also learned that if your form name has a hypen in it then the script

txtFooter = concat("this is version ", form-name.desc.version)

will drop the "-name" and say that "form" is an invalid accessor.  Everything else work work just fine, and changing the - to a _ fixes the problem, but still.....

Avatar

Level 7

I believe "form" is a reserved word

Avatar

Level 2

I tried it with a couple of words after the "-" and it is something about that character that causes it to protest.

Avatar

Level 10

Hi,

The hyphen can't be used in a variable name in JavaScript, but if you want one in your form name then you can reference the version metadata value with

the xfa.resolveNode method

So;

txtFooter = concat("this is version ", xfa.resolveNode("form-name.desc.version").value)

Bruce