Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Getting error message "missing ; before statement 24"

Avatar

Level 7

Hello,

I'm getting the error message "missing ; before statement 24" in the following script:

//Create a variable to hold the document object

var StartDate = (xfa.form.form1.page1.signature.StartDate.rawValue);
var EndDate = (xfa.form.form1.page1.signature.EndDate.rawValue);
var assocName = (xfa.form.form1.page1.signature.assocName.rawValue);
var assocID = (xfa.form.form1.page1.subForm1.assocID.rawValue);
var assocEmail = (xfa.form.form1.page1.subForm1.assocEmail.rawValue);
var assocExt = (xfa.form.form1.page1.subForm1.assocExt.rawValue);
var assocDept = (xfa.form.form1.page1.subForm1.assocDept.rawValue);
var mgrName = (xfa.form.form1.page1.subForm1.mgrName.rawValue);
var mgrEmail = (xfa.form.form1.page1.subForm1.mgrEmail.rawValue);
var salariedHourly = (xfa.form.form1.page1.subForm1.salariedHourly.rawValue);
var directReports = (xfa.form.form1.page1.subForm1.directReports.rawValue);
var perfRating = (xfa.form.form1.page1.subForm1.perfRating.rawValue);
var howLongWorking = (xfa.form.form1.page1.request.howLongWorking.rawValue);


//SUBMIT DATE
if (StartDate == "") Then
xfa.host.messageBox( "Please enter a Submit Date" );
xfa.host.setFocus("xfa.form.form1.page1.subForm1.StartDate");

//HIRE DATE
elseif (EndDate == "") Then
xfa.host.messageBox( "Please enter a Hire Date" );
xfa.host.setFocus("xfa.form.form1.page1.subForm1.EndDate");

//NAME OF ASSOCIATE
elseif (assocName == "") Then
xfa.host.messageBox( "Please enter your Name" );
xfa.host.setFocus("xfa.form.form1.page1.subForm1.assocName");

//ASSOCIATE ID
elseif (assocID == "") Then
xfa.host.messageBox( "Please enter your ID" );
xfa.host.setFocus("xfa.form.form1.page1.subForm1.assocID");

//ASSOCIATE EMAIL
elseif (assocEmail == "") Then
xfa.host.messageBox( "Please enter your email address" );
xfa.host.setFocus("xfa.form.form1.page1.subForm1.assocEmail");

//ASSOCIATE EXTENSION
elseif (assocExt == "") Then
xfa.host.messageBox( "Please enter your telephone extension" );
xfa.host.setFocus("xfa.form.form1.page1.subForm1.assocExt");

//ASSOCIATE DEPARTMENT
elseif (assocDept == "") Then
xfa.host.messageBox( "Please enter your department" );
xfa.host.setFocus("xfa.form.form1.page1.subForm1.assocDept");

//MANAGER NAME
elseif (mgrName == "") Then
xfa.host.messageBox( "Please enter your manager's name" );
xfa.host.setFocus("xfa.form.form1.page1.subForm1.mgrName");

//MANAGER EMAIL
elseif (mgrEmail == "") Then
xfa.host.messageBox( "Please enter your manager's email address" );
xfa.host.setFocus("xfa.form.form1.page1.subForm1.mgrEmail");

//SALARIED HOURLY
elseif (salariedHourly == "") Then
xfa.host.messageBox( "Please enter whether your are salaried or hourly" );
xfa.host.setFocus("xfa.form.form1.page1.subForm1.salariedHourly");

//DIRECT REPORTS
elseif (directReports == "") Then
xfa.host.messageBox( "Please indicate whether you have any direct reports" );
xfa.host.setFocus("xfa.form.form1.page1.subForm1.directReports");

//PERFORMANCE RATING
elseif (perfRating == "") Then
xfa.host.messageBox( "Please certify your last performance rating" );
xfa.host.setFocus("xfa.form.form1.page1.subForm1.perfRating");


//HOW LONG WORK
elseif (howLongWorking == "") Then
xfa.host.messageBox( "Please indicate how long you anticipate working this arrangement" );
xfa.host.setFocus("xfa.form.form1.page1.questions.howLongWorking");

else
Button6.execEvent("click");
page2.presence = "visible";

EndIf

I've been hunting for several hours and can't seem to find or correct the problem. Can anyone help?

Thanks,

MDawn

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

It woudl be easier if  I cpoudl see the form  in action .....an you send it to LiveCycle8@gmail.com and include a description of how to reproduce the issue.

Paul

View solution in original post

3 Replies

Avatar

Level 10

Hi,

your Script is in FormCalc not in JavaScript.

Make shure your set the correct language in the script editor.

Why are you using brackets here?

var StartDate = (xfa.form.form1.page1.signature.StartDate.rawValue);

you can write it as

var StartDate = xfa.form.form1.page1.signature.StartDate.rawValue

Also, in FormCalc you don't need the semicolon ; at the end of the lines.

And, your keywords "Then" and "EndIf" are wrong, correct is "then" and "endif".

if (StartDate == "") then

     xfa.host.messageBox( "Please enter a Submit Date" )

     xfa.host.setFocus("xfa.form.form1.page1.subForm1.StartDate")

...

elseif (howLongWorking == "") then

     xfa.host.messageBox( "Please indicate how long you anticipate working this arrangement" )

     xfa.host.setFocus("xfa.form.form1.page1.questions.howLongWorking")

else

     Button6.execEvent("click")

     page2.presence = "visible"

endif

Avatar

Level 7

I'm still having trouble. I tried to change the script to JavaScript. Now I'm getting "subForm1 not defined" error message. But it appears that subForm1 is set up properly.

Any thoughts?

Thanks,

MDawn

Avatar

Correct answer by
Former Community Member

It woudl be easier if  I cpoudl see the form  in action .....an you send it to LiveCycle8@gmail.com and include a description of how to reproduce the issue.

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----