1
0
-1

Hi, 


I am wanting to create a click rule which will load a specific page. 

i.e. a button on page 1 will go to page 2 and a button on page 1 will go to page 3. 

I have tried the below but the second button doesn't work 


first button : 

var pageNo = 2;
Form.goToPage(pageNo);


second button: 

var pageNo = 23
Form.goToPage(pageNo);


Can you please advise what i am doing wrong? 


Thanks, Hannah 

    CommentAdd your comment...

    4 answers

    1.  
      2
      1
      0

      Hi Hannah,

      What I did for this error is like what Sacha's solution but I just add the another parameter

      Form.goToPage("pageReferenceId",true)

      Form.goToPage(pageIdOrNo, skipValidation)

      pageIdOrNo
      The page number or page id of the page to navigate to.
      skipValidation
      If set to true, page validation will be skipped.
        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi Bill and Sacha, the form.go.to page function is not working using both your methods. I have another idea to do a click rule which moves each button to the same page (3) and there will be visibility rules for each proposed button (Section). Unfortunately this not working, are you able to confirm in a click rule there can be multiple actions i.e the below is correct?  


        Button 1 click rule:

        Form.$Pages.move(true);

        data.sfmvis === "TRUE" ;


        Thanks!


        1. Bill Frost

          Hi Hannah,

          Yes, you can write as much code as you want in a Click rule.

          Have you tried using Google's F12 developer tools to bring up the 'Console', and check to see if any errors are displayed there when you click the button that fails?  You could also use the debugger to get a closer look at what is happening by following this advice: Advanced Debugging of Maestro Forms#LocatingaJavaScriptRuleforDebug

          I've been assuming your page 3 is actually visible.  Is this the case?  Do you have any visibility rules on the page level that would prevent it from showing?

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

        Hi Hannah,

        Do you have validation or mandatory fields that would prevent you from navigating to the following page?

        1. Hannah MacDonald

          Thanks Bill. I dont have any mandatory/val fields and I'm testing the form in UAT to that shouldn't be an issue.

        2. Bill Frost

          Maybe you have a typo?

          I've tried with a test form using Form.goToPage(2) and Form.goToPage(3) and it works fine.

          Do you really have 'var pageNo = 23' instead of 'var pageNo = 3' in your code?

        3. Hannah MacDonald

          You're right there was a typo in my comment but the rule has the correct inputs.

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

        Hi Hannah,

        I've experienced similar problems. I think it has something to do with a number not necessarily being recognised as an integer.

        Unless you need to do maths, it actually makes more sense to use the reference ID:

        Form.goToPage("aboutyou")



          CommentAdd your comment...