Forums

Can one nest Event Switcher [GH]?

NickOg 29 Apr, 2013
Hi Bob,

Done it again - cutting code when I suspect the actions will do the trick. Can I nest event switchers?

As per attached - I want to
1. load one form if a user is logged in
2. Load a second form if a user is logged in and needs to renew
3. Load a third form if a user has logged in and needs to re-join

I think the attached frame work illustrates what I have in mind.

[attachment=0]4Grey0.png[/attachment]

Regards

Nick
GreyHead 29 Apr, 2013
Hi Nick,

You can nest Event Switchers, but I wouldn't do it. You only have three separate outcomes so one Event Switcher will handle it if you add the logic to it. The pseudo code would be something like:
a) if user is not logged in: event_a redirect
// code here to look up user renewal status
b) if user needs to renew: event_b redirect to renewal form
else 
c) if user needs to re-join: event_c redirect to re-join form
else
d) redirect user to standard form (this could be event_d or just the next event in the On Submit event.


Bob
NickOg 29 Apr, 2013
Thanks again, Bob. I really owe you another beer or three! Shortly!!

And the event can as easily be an 'on load' event as a 'submit' event I assume?

Nick
GreyHead 29 Apr, 2013
Hi Nick,

Yes it will work On Load as well as On Submit. If it's in the OnLoad then you can let the default case (d) just show the current form without any redirection.

Bob

For other readers: if you have more than four separate events you can put one Event Switcher after another to handle four more events each.
This topic is locked and no more replies can be posted.