Button to autoset values to current page using values from previous page

If I’m understanding your issue correctly:

Key fact: When you assign a key to a widget, that key will get deleted along with that widget on any script run where it doesn’t appear (e.g. switching pages).

Fix: If you want a widget to remain stateful in the presence of switching pages, you need to copy that widget’s information into another key that is not directly tied to a widget.

Solutions

There are two ways to fix this. One way is a little hacky and interrupts the process by which a widget’s key is deleted when a widget doesn’t render. This solution needs to be placed on every single page in an app to work. The other solution is a few more lines of code, but only needs to be placed on the page with the widget you’re concerned about.

Solution 1: Interrupt the widget cleanup process

Solution 2: Create copies of each key you want to keep (such as with a _ prefix)