I suggest instead of setting the cookie values into the inputboxes themselves, you set them on the attributes for the specific input boxes. This'll make sure these values get sent to the server once the user presses Save.
See here for information how to set them.
Edit: I figured out a way that doesn't require creating a new custom widget.
Simply put that into the page and put in the code you already had, and use this format to write the attributes:
The widget's eval is executed within the widget's context, so it has access to the context object!
Based on your information, you could try triggering the onchange event or onleave event of the input box after setting the value. That might properly store the data in the object that is sent to the server when pushing the microflow button.