Go back to previous form from current form

the approach in the sample app only seems to work if there is a single path from form to form. What if several forms lead to single form, how can I keep track of which particular form I came from so I go back to that form?