Expand my Community achievements bar.

SOLVED

How to mask a string with asterisks (*) when printing?

Avatar

Level 2

Dear Expert,

Kindly give me solution below the issue.

I have created two field 2 in Adobe LiveCycle Designer --> Text Field 1 in that text field enter the value manually like(123434567890)

i need to print the field value in Fields number with “*” up to the last 4 digits in adobe forms. (********7890)

how can i write the script code in form calc or js in Adobe LiveCycle Designer .

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi Radzmar,

Thanks for your update.

Below the code run sucessfuly in form calc.

$.rawValue=Concat(form1.#subform[0].B.rawValue, form1.#subform[0].TextField2.rawValue)

View solution in original post

3 Replies

Avatar

Level 10

Hi,

all you need is two small scripts in the printed fields prePrint and postPrint events:

prePrint event

if (!this.isNull) {

var cStr = this.rawValue,

cMaskString, cKeepStr, cAsterisk,

iLength = cStr.length;

// Save rawValue as a global variable (don't use var!)

cGlobalStringVar = cStr;

// Replace except the last for characters with asterisk.

this.rawValue = Array(iLength-3).join("*").concat(cStr.slice(iLength-4, iLength));

}

postPrint event

// Restore to original raw value from global variable

this.rawValue = cGlobalStringVar;

Hope this helps.

Avatar

Correct answer by
Level 2

Hi Radzmar,

Thanks for your update.

Below the code run sucessfuly in form calc.

$.rawValue=Concat(form1.#subform[0].B.rawValue, form1.#subform[0].TextField2.rawValue)

Avatar

Level 3

I need to mask out an Account Number field when printing but can't seem to make ithings work.

Where does your suggestion go under form calc?  Is radzmar's suggestion needed with yours??