• Resolved caiovisk

    (@caiovisk)


    Working with a multipage form, all works great when pages are one by one, however there is no option to show/hide pages based on Conditional Logic.

    Let’s say I have 04 pages on my form, from page 01 when hit next button the page 02 only need to show if Conditional Logic from a field on page 01 met, otherwise it goes to page 03 and so on.

    Is there a way to enable Conditional Logic for pages on the plugin? what is the options to achieve that?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author fabianlindfors

    (@fabianlindfors)

    Hi!

    Unfortunately, conditional logic is not currently supported for page fields. You might be able to program this yourself in Javascript. There is a Javascript action called “af/form/page_changed” which you could listen to and check if the next page should be displayed. If not, you could navigate to another page with a tiny bit of code which I can give you if you decide to go that route.

    All the best!

    Thread Starter caiovisk

    (@caiovisk)

    Hi Mate,

    Thanks for the quick reply…

    I’ve used the ‘af/form/page_changed’ approach and it works! howerver would be good to give the user an option to manage this on the backend, other than that the plugin is great! Thank you!

    So I ended up doing:

    //Listen to page changes
    acf.addAction( 'af/form/page_changed', function( pageTo, pageFrom, form ) {
      switch(pageTo){
       case 2:
         //My condition logic
         break;
      }
    });  
    Plugin Author fabianlindfors

    (@fabianlindfors)

    Perfect! I do have this feature on the roadmap but can’t say for sure when I will get to it.

    If not, you could navigate to another page with a tiny bit of code which I can give you if you decide to go that route.

    Hi, fabianlindfors!

    Please give bit of that code. Thx

    Plugin Author fabianlindfors

    (@fabianlindfors)

    Hi!

    You can use something like this:

    var form = af.forms["FORM_KEY"];
    af.pages.nextPage(form);
    
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Conditional Logic option on Pages’ is closed to new replies.