Don't think you need a script trigger here unless there is some detail that I am missing.
You can write a script that uses Go To Related Records to switch to the form view layout and pull up record of the portal row that the user selected.
You can place a button in the portal row, or, if the user doesn't need to edit the fields, you can select all the fields in your portal row and use Button Setup... in the Format menu to turn the fields into a button that performs this script. That way, the user just clicks the portal row to switch to the other layout.
When you create this Go To Related Record step, be careful to select the same exact name in "get related record from" as you have specified in Show Records From in Portal Setup... for your portal.
On your form view layout, you can place a button set up to use Go To Layout to reutrn the user to their original layout. (And if you have multiple layouts that take the user to the same form view layout, there are ways that a single "back" button can take them back to the correct layout.)