1
0
-1

I've added the following script:

if ((data.formStage == "initial") && (Form.getCurrentPageNumber() == 1) ){
   Form.goToPage(2);
}

It's a calculation rule on a block on the first page, and fails with the following error in the console:

Uncaught SyntaxError: Unexpected token ifi @ /maestro/secure/app/main.js:1(anonymous function) @ /maestro/secure/app/main.js:1(anonymous function) @ /maestro/secure/lib/angular-1.5.8/angular.min.js:131$eval @ /maestro/secure/lib/angular-1.5.8/angular.min.js:145$digest @ /maestro/secure/lib/angular-1.5.8/angular.min.js:142(anonymous function) @ /maestro/secure/lib/angular-1.5.8/angular.min.js:145e @ /maestro/secure/lib/angular-1.5.8/angular.min.js:45(anonymous function) @ /maestro/secure/lib/angular-1.5.8/angular.min.js:48
(unknown) Uncaught SyntaxError: Unexpected token if

 

 

I'm trying to get the form to skip the first page of the form when the forStage is "initial" (This get's updated when the form is saved), and you only see that first page on resume.

 

 

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      There are two issues here:

      1) Calculation rules need to return something. In this case, use the following:

          return undefined;

      2) The following syntax is not correct

          (Form.getCurrentPageNumber() == 1)

      The correct syntax is yet to be determined, but the whole condition seems unnecessary in this situation.

       

        CommentAdd your comment...
      1.  
        1
        0
        -1

        A calculation rule always expects a return statement. If it doesn't find one in your code, it adds one. I suspect that's where things are going wrong.

        However...

        I'm not sure that doing what you're trying to do, in a calculation rule, is the right way to do it. I suspect you should try this on the "Initialization" even which is on the top level form object.

        1. Sacha Trube

          How do you add a script for "initialization"?

        CommentAdd your comment...