Silly me, I'm trying to do two things in one place - I just realised.
I need a separate mechanism to create the join table records, using a script.
I think I'm back on the right road now. (But feel free to confirm!)
The easiest way I found is to have a second portal for selecting "agencies" to assign them to Towns. To do this you need another TO of agencies with a cartesan relationship to Towns. That portal will then list all Agencies. Assign a button on the portal row (or make the agency name field a button) to run the following script
Set Variable $town = Town ID
Set Variable $agency - Agencies 2::agency ID
Go To Layout Join Table
Set Field Join Table::town ID to $town
Set Field Join Table::agency ID to $agency
Go To Original Layout
The agency you selected should then show up in your portal based on the Join Teble relationship.
Usually, the method for doing this, as I think you have discovered, is to use a portal to the Join table, not a portal to Towns or Agencies.
If you enable "Allow creation of records via this relationship" for the join table in the Towns to Join relationship, then you can create a new record in the join portal on your Towns layout simply by entering data in the bottom blank row of the portal. If you then select the ID of the Agency in a drop down list or pop up menu, you can then complete the link from Town to Join to Agency records.
I know you've looked at a 'demo' or two but here's one I uploaded fairly recently that covers all of this with copious notes and then goes on to explore some alternatives to the simple portal that can be used: http://www.4shared.com/file/dZ0bjclw/ManyToManywDemoWExtras.html
Feel free to post back here with questions if there is some part of that demo you can't figure out.
Thank you both for your very quick answers.
I tried the second one first as it seemed simpler and after a bit of head scratching I figured out where I'd gone wrong. Because the join table is empty, I couldn't grasp why I would use that to create the dropdown (how can there be a relation when there's a gap?, I thought). Looking at your demo file said that there could, even if it seemed a bit "odd".
I will also look at Mark's suggestion because it seems to cover an important scripting concept that could be useful to learn and understand.
You'll find a variation of Mark's scripted suggestion in the demo file. Take a look at the "checkboxes" layout.