Skip to main content
Participating Frequently
July 16, 2019
Answered

syntax errors

  • July 16, 2019
  • 6 replies
  • 2048 views

I am trying to follow this walk through: https://acrobatusers.com/tutorials/change_another_field

my code for the first part is:

if( event.willCommit ) {

    if(event.value == "") this.resetForm(["Account Manager","MOBO","Customer","CNAME","Contact","Cphone","ADD1","ADD2","CPPC","CN1","CN2","CN3","CN4","CN5","CN6","CN7","CO1","CO2","CO3","CO4","CO5","CO6","CO7","CO8","EUI"]); else SetFieldValues(event.value);

}

and my code for the second part is here: WeTransfer

I keep getting a syntax error...

the file Im working on is here: WeTransfer

I am trying to learn Java, and do not claim to be fluent in this coding.

any help would be amazing!... thank you!

This topic has been closed for replies.
Correct answer Bernd Alheit

The entry MOBO is not defined in DeptData.

6 replies

ElyRossAuthor
Participating Frequently
July 18, 2019

I have a checkbox that I was hoping would drive the dropdown to a certain selection... is that possible?

try67
Community Expert
Community Expert
July 18, 2019

What do you mean?

ElyRossAuthor
Participating Frequently
July 18, 2019

my file here...

WeTransfer

right now I have the drop down "mailing on behalf of"... however, I have a checkbox next to it, that if checked, should force the drop-down to a certain entry... is it possible to have that work?

ElyRossAuthor
Participating Frequently
July 18, 2019

Thank you again...  I have removed as much as possible and am now just trying to work with the very first entry... i have only one field that is working... what am i missing for the other fields?

my code:

// Place all prepopulation data into a single data structure

var DeptData = { "Playground Guys":{ AccountManager: "Rich Berg",

                                     Customer: "Playground Guys",

                                     CNAME: "Playground Guys",

                                     Contact: "",

                                     Cphone: "",

                                     ADD1: "PO Box 4031",

                                     ADD2: "",

                                     CPPC: "Olds AB  T4H 1P7",

                                     CN1: "1",

                                     CN2: "0",

                                     CN3: "6",

                                     CN4: "5",

                                     CN5: "3",

                                     CN6: "0",

                                     CN7: "0",

                                     CO1: "4",

                                     CO2: "2",

                                     CO3: "3",

                                     CO4: "9",

                                     CO5: "0",

                                     CO6: "0",

                                     CO7: "1",

                                     CO8: "8",

                                     EUI: "" }};

function SetFieldValues(cDeptName)

{

  this.getField("AccountManager").value = DeptData[cDeptName].AccountManager;

this.getField("MOBO").value = DeptData[cDeptName].MOBO;

this.getField("Customer").value = DeptData[cDeptName].Customer;

this.getField("CNAME").value = DeptData[cDeptName].CNAME;

this.getField("Contact").value = DeptData[cDeptName].Contact;

this.getField("Cphone").value = DeptData[cDeptName].Cphone;

this.getField("ADD1").value = DeptData[cDeptName].ADD1;

this.getField("ADD2").value = DeptData[cDeptName].ADD2;

this.getField("CPPC").value = DeptData[cDeptName].CPPC;

this.getField("CN1").value = DeptData[cDeptName].CN1;

this.getField("CN2").value = DeptData[cDeptName].CN2;

this.getField("CN3").value = DeptData[cDeptName].CN3;

this.getField("CN4").value = DeptData[cDeptName].CN4;

this.getField("CN5").value = DeptData[cDeptName].CN5;

this.getField("CN6").value = DeptData[cDeptName].CN6;

this.getField("CN7").value = DeptData[cDeptName].CN7;

this.getField("CO1").value = DeptData[cDeptName].CO1;

this.getField("CO2").value = DeptData[cDeptName].CO2;

this.getField("CO3").value = DeptData[cDeptName].CO3;

this.getField("CO4").value = DeptData[cDeptName].CO4;

this.getField("CO5").value = DeptData[cDeptName].CO5;

this.getField("CO6").value = DeptData[cDeptName].CO6;

this.getField("CO7").value = DeptData[cDeptName].CO7;

this.getField("CO8").value = DeptData[cDeptName].CO8;

this.getField("EUI").value = DeptData[cDeptName].EUI;

}

what i am referencing: WeTransfer

and my file:WeTransfer

thank you in advance for the help!... im sorry its so painful!...

Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
July 18, 2019

The entry MOBO is not defined in DeptData.

ElyRossAuthor
Participating Frequently
July 18, 2019

thank you so much! this has helped me!

ElyRossAuthor
Participating Frequently
July 17, 2019

SyntaxError: missing ; before statement

1: at line 2

Ln 28, Col 1

Bernd Alheit
Community Expert
Community Expert
July 17, 2019

Use this:

"Playground Guys": { ...

ElyRossAuthor
Participating Frequently
July 17, 2019

You're still using the wrong kind of quotes in your code.


my goodness, I just want to bang my head on the wall.. can I simply switch them to single quotes?... im on a mac, is there a better way to prepare this code other than text editor?

ElyRossAuthor
Participating Frequently
July 17, 2019

great, thank you!... i have updated all of these... i now i have an error as below:

it appears there is a ; mark before... but im still missing something...

again, i really appreciate the feedback!.. thank you so much!

try67
Community Expert
Community Expert
July 17, 2019

You can't include spaces in the names of the variables in your data model.

try67
Community Expert
Community Expert
July 17, 2019

PS. In the future please post your code as text, not as an image.

ElyRossAuthor
Participating Frequently
July 17, 2019

Hey Try,

do you mean single quotes vs double?...

try67
Community Expert
Community Expert
July 17, 2019

No. I mean straight quotes (like this: " ), vs. curly quotes (like this: “ and ”).

try67
Community Expert
Community Expert
July 16, 2019

You must only use straight quotes in your code, not curly ones.