Can a webflow's action state have multiple redirects on success?
Say, I开发者_StackOverflow社区 have this type of webflow:
def myFlow = {
state1 {
}
on("next").to("stateAct")
stateAct {
action {
... DB stuff ...
}
}
on("success").to("state2")
state2 {
}
on("prev").to("state1")
}
Now, the contents of "stateAct" is common between state1 and state2. Meaning, if I press "next" from state1, I need to pass by stateAct before I can go to state2 (which is the current implementation) and if I press "prev" in state2, I need it to pass by stateAct before it goes to state1. Obviously, in the sample webflow above, it doesn't do the latter.
So, my question is, is there a way to detect in stateAct who called it (state1 or state2) so that I can redirect accordingly on "success"? Or something similar to that behavior?
Thanks!
-Lee
Why not store this info in a flow-scoped variable? Something like:
def myFlow = {
state1 {
on("next") {
flow.originator = 'state1'
}.to("stateAct")
}
stateAct {
action {
if (flow.originator == 'state1') do something
if (flow.originator == 'state2') do something else
}
}
on("success").to("state2")
state2 {
on("prev"){
flow.originator = 'state2'
}.to("stateAct")
}
精彩评论