Forums

page 4 of multi-page form will not render

t3living 28 Mar, 2016
I have a multipage form with the following logic
page 1 ==>takes name, address, etc as registration information
on submit ==> renders page 2

page 2 ==> presents two buttons Login & Create (both buttons have name=choice and values of "Login" and "Create")
on loginornew
event switcher :
<?php
switch ($form->data['choice']){
     case "Login":
          return "fromloginbutton";
          break;
     case "Create":
          print_r($form->data);
          return "newaccountbutton";
          break;
}?>

On fromloginbutton ==> Event Loop (login)
On newaccountbutton ==> Event Loop (newaccount)

the form events
On login ==> has multipage and render html(page 3)

On newaccount==> has multipage and redener html(page 4)

the path of page1==>page2==>page 3 works fine
but page 1==>page 2 ==>page 4 does not work. I added the print_r statement above to insure that the switch was returning the right event name and it does, but page 4 never renders. Moreover, if I change the On newaccount form event to render something other than page 4, nothing renders. all I have is the output from the print_r statement.
t3living 28 Mar, 2016
followed that example
GreyHead 29 Mar, 2016
Hi t3living,

Please post a link to the form so I can take a quick look.

Bob
t3living 29 Mar, 2016
i created a simplified version here:

http://www.missionalive.org/ma/index.php?option=com_chronoforms5&chronoform=test_logic

p1 - submit button ==> On submit (multi page, display message, html render(p2))

p2 - login_button and create_button (both named choice, values = "Login" and "Create") ==> processchoice

On processchoice
==== event switcher======
<?php
print_r($form->data);
switch($form->data['choice']){
   case "Login":
         echo "returning  gotologin";
         return 'gotologin';
         break;
   case "Create":
         echo "returning gotocreate";
         return 'gotocreate';
         break;
}?>

Events: gotologin (eventloop:loginpage)
gotocreate (eventloop:createpage)
==============================
On loginpage (multipage, html (p3,processlogin)
On createpage (multipage, html (p4,processcreate)

p3 - login form (text box, submit)
p4 - create form (text box, submit)

On processlogin (multipage, html (p5))
On processcreate (multipage, html(p5))

p5 - pay button
t3living 29 Mar, 2016
enjoy the coffee from nquizitor
GreyHead 29 Mar, 2016
Hi t3living,

Thanks for the coffee - much needed today - had an early start to meet a ferry at 8am.

Your test form looks Ok to me as far as it goes - it shows 'returning gotocreate' but then stops. Do you have a Load Form action in that event to do the next bit?

Bob
t3living 29 Mar, 2016
I did some more experimenting and kept coming to the conclusion that it was the eventswitcher events that were the issue. So I replaced the eventswitcher with a new one and left the event names "success" and "fail", entered the php to return "success" and "fail" and things worked as they should. so there is something in eventswitcher which is not matching the returned string to the eventswitcher-eventnames reliably.
GreyHead 30 Mar, 2016
Hi t3living,

I wonder if perhaps you had a space between the event names - one of CF's minor bugs is that it can't handle strings like name, name - only name,name. I've seen this in several different places. I've also used custom names in Event Switchers successfully so they do 'work'.

Bob
This topic is locked and no more replies can be posted.