Jump to content

Reference an Object in a Function


merski007

Recommended Posts

Hello,

 

I'm having an issue with the Preview not displaying correctly. The rule I'm using validates correctly, but breaks on preview.

 

In a nutshell, here is the code for this function

 

// declare variable color hits

HIT_COLOR_BLACK = "black";

HIT_COLOR_WHITE = "white";

 

// create array of objects

HIT_COLOR_CHOICE = {1: HIT_COLOR_BLACK, 2: HIT_COLOR_WHITE};

 

// retrieve items in desired color

function getItem(item, colorNumber){

return '<color name=' + HIT_COLOR_CHOICE[colorNumber] + '>' + '<tracking newsize="6">' + item;

}

 

 

During positioning and proofing, we will switch the color hits globally, just to check our work.

 

When I validate the rule with this function, the correct results appear:

<color name=black><tracking newsize="6">pizza

 

but the color does not come through on preview. The text will default to the color set in the text box. I have the 'Treat returned string as tagged text' box checked, so it's not that.

 

If i hardcode the color value into the function, or use the variable name itself, the rule works. This would just cause a lot of work on my end to create a function for each color i have.

 

All help is appreciated.

 

Here are system details:

FP: 9.3.36

OS: Mac OS 10.12.6

Acrobat 11

 

Cheers,

Mark

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...