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

Javascript works in Designer preview mode, but not when invoked via process


Level 2
I have a fragment consisting of a subform and a text object. The subform has the following Javascript for its initialize event:


var cars = $;

var showMe = false;

for (var i = 0; i < cars.length; i++) {

if(cars.item(i).color && cars.item(i).color.value == 'RED')


showMe = true;




if(!showMe) {

this.presence = 'hidden';



The code is supposed to loop through all my input XML data's cars, see if each car has a color element, and if so, see if the color is RED. If any of the cars have a color of RED, the fragment should be visible. Otherwise, it should be hidden.

The Javascript works fine when I preview the fragment in Designer using a sample XML input file with no color element (i.e. the text in the fragment is hidden).

The Javascript works fine in my main document (which has the fragment included in it) when in preview mode in Designer.

The Javascript does not work when I invoke my process in LiveCycle server. I pass in data that has 1 car without a color element, and for some reason my fragment is visible.

Is there something wrong with my Javascript? Is this the wrong way to check to see if an XML element is present? Is something else wrong?

Any help would be appreciated!


2 Replies


Level 2
I guess a more appropriate question might be:<br /><br />How can I tell if my XML input data does or does not contain an element? Let's say I have<br /><br /><input><br /> <cars><br /> <car><br /> <make>VW</make><br /> </car><br /> </cars><br /></input><br /><br />How can I use Javascript to safely determine if the car has a <color> element?


Level 2
Solved my problem - I needed to use resolveNode to check for the existence of my element.