I have a, er, "challenge" which involves 3 tables, each with a corresponding form. Let's call these tables "a", "b" and "c" where c is a child of both a and b. Each table has a form: forma, formb and formc.
To state it generally, from formc I want to be able to run a method (e.g. from a button on formc) which behaves slightly differently depending on if formc was reached via the relation tablea_to_tablec or via tableb_to_tablec.
More particularly, formc is to show a listing of the set of table-c records which are children of either a particular table-a record or of a particular table-b record. formc has a button to "add record". If formc was reached via the relation tablea_to_tablec then the "add" method should construct a child record by assuming the current table-a parent and prompting the user for a
record from table-b to use as the other parent (and vice-versa).
Currently I can see only two ways of handling this:
1) replicate formc - call formc-a from forma and formc-b from formb
2) on displaying formc, set the name of the button element to indicate via which relation formc was reached. Maybe I'm being paranoid, but this smells to me like the dreaded "self-modifying code" (which IIRC we discarded as a Bad Idea over a quarter of a century ago).
Any other suggestions?
Thanks,
Neale.