@grief - is this a 1-to-1 join, so "repeat" is No?
I seem to recall there's some really hairy code in out form submission stuff to do with 1-to-1, because when it's a non-repeating join, it isn't obvious which way the join should be, eg. which of the selected fields is the FK.
In other words, if you set Repeat, we know that the field you select on the "other" table is the FK.
But in a 1-to-1, it's could be either one. So we then look to see which of the selected fields is the PK for it's table, on the assumption that one of them will be, and by a process of elimination that means the other one must be the FK. And that assumption about one of them being the PK means that's what we write into the FK ... i.e. we assume the FK will take the PK's value. Which is where a lot of the complexity of our join handling comes in, in that we need to write out the row with the PK on it before we can then write out / update the joined row, with the PK value from the PK's row (because we won't know that value till after writing it out).
But of course, if you are trying to do what you are trying to do, which is link between two tables where neither of the fields involved is the PK of the table ... then our code breaks, and does what you observed, which is write the PK value into whichever one we decided was the FK. Which we shouldn't be doing.
Sorry it's taken me a while, I had to dredge this stuff up from memory of the last time i worked on this code. And I now remember realizing that we need to add a setting on the join options, which tells us which (if either) is the FK in the join, or whether they are just a mutual key, rather than a FK / PK arrangement.
Bottom line, this isn't trivial, and isn't going to be easy to fix.
Ah hah, I just checked the code, and if you look at the tortuous logic in ./components/com_fabrik/models/form.php, in the processToDb() method, starting around line 1364 ("trying to get one-to-one joins working"), around line 1400 is this comment:
PHP:
// $$$ hugh - at this point we are assuming that we have a situation where the FK is on the joined table,
// pointing to PK on main table. BUT ... we may have a situation where neither of the selected keys are
// a PK, i.e. two records are joined by some other field. In which case we do not want to set the FK val!
// So, we need some logic here to handle that!
So ... I'm going to have to try and work out what we need to do if neither of the selected elements is a PK element.
-- hugh