When you first enter browse mode the pop-up field displays the last layout the file was on instead of the layout the user is currently on.
Seems like that would only happen if you are using some other means to change layouts than this field and script.
You could write a script that is performed by OnLayoutEnter that checks the name of the current layout and uses set field to update your field with the appropriate value from your value list.
What you show is a common approach for such a layout navigation drop down or pop up. It could be simplified to a single line:
Go to Layout [Projects::Layout Selection ]
If you use the "layout name by calculation option" and also give your layouts the same exact names as the values in your value list or vice versa.
Thanks for the quick reply Phil! I used your simpler script and works perfectly!
I realize that I will need a OnLayoutEnter script. I have objects on some of the layouts that when clicked take you to another layout. For instance I have a project page layout and when a project is clicked you are taken to the project detail layout for that record. I've spent some time trying to write the script but having no luck. How would you write it?
You may not need the trigger. The object that you click should use perform script and your script should both take the user to the layout and use set field to assign the appropriate value to the field.
You only need the OnLayoutEnter Trigger if there are non scripted ways to access the layout and since such a layout can be tripped when you don't want a script to trip that script trigger, you might want to consider incorporating that step into the your navigation scripts instead of using the trigger.