Populate {THIS THING} with the user inputted content from a text field.

kevm75130910

09-09-2019

I have a PDF that someone else built that has it working.  I am trying to fix one that is not working.  I look at the ones that are working and i can't figure out why mine won't.

Working, Existing Script:

form1.#subform[1].FANcode::exit - (JavaScript, client)

//+ GENERATED - DO NOT EDIT (ID:18DF5D3C-8BC1-477C-9B7F-181F05181DFE CRC:2376755895)

if (this.resolveNode("PromptOff").rawValue == "0" && this.resolveNode("DDATT").rawValue == "Yes" && (this.resolveNode("$").rawValue == null || this.resolveNode("$").rawValue == "")) {

  xfa.host.messageBox("Please enter your eight-digit AT&T FAN Code.", "Code needed", 3);

}

//-

//+ GENERATED - DO NOT EDIT (ID:A7084F23-760E-4BA7-B2E3-D2A80B545302 CRC:479065085)

//+ Type: Action

//+ Result1: ShowDialog("information","Your eight digit FAN code must be entered for your employees to use this discount.","No FAN Code Entered")

//+ Node1: form1[0].#subform[1].FANcode[0]

//+ Condition1: TextField("$Node1","empty","")

//+ ActionName: FANcode.exit

if ((this.resolveNode("$").rawValue == null || this.resolveNode("$").rawValue == "")) {

  xfa.host.messageBox("Your eight digit FAN code must be entered for your employees to use this discount.", "No FAN Code Entered", 3);

}

//-

form1.#subform[1].FANcode::change - (JavaScript, client)

var n= xfa.event.newText;

var textParse=n.toString();

var ATTLink="http://www.att.com/wireless/premiergpo"+textParse.charAt(7);

this.resolveNode("Table1.ATT.ATTRow.TextField").rawValue = ATTLink;

this.resolveNode("Table1.ATT.ATTRow.ATTFanCode").rawValue = xfa.event.newText;

My Broken Script:

form1.#subform[1].SprintHCorNonHC::change - (JavaScript, client)

if (this.resolveNode("PromptOff").rawValue == "0" && this.resolveNode("SprintHCorNonHC").rawValue == "Yes" && (this.resolveNode("$").rawValue == null || this.resolveNode("$").rawValue == "")) {

  xfa.host.messageBox("Please enter your Sprint Corporate ID", "Code needed.", 3);

}

form1.#subform[1].SprintHCorNonHC::change - (JavaScript, client)

if ((this.resolveNode("$").rawValue == null || this.resolveNode("$").rawValue == "")) {

  xfa.host.messageBox("Please enter your Sprint Corporate ID", "Code Needed", 3);

}

this.resolveNode("Table1.Sprint.SprintRow.TextField").rawValue = xfa.event.newText;

What's the deal with all the GENERATED stuff in the other scripts, but mine lacks all that?

Thank you in advance.

Accepted Solutions (1)

Accepted Solutions (1)

_Bruce_Robertson

MVP

09-09-2019

Hi,

The generated code comes from using the Action Builder (under to the Tools menu).

The working script seems to be in the exit event your script seems to be in the change event? In the change event you should use xfa.event.newText not this.resolveNode("$").rawValue.

The change event might be were you want the line this.resolveNode("Table1.Sprint.SprintRow.TextField").rawValue = xfa.event.newText; as this will update the floating field as you type, but you probably want the other code in the exit event