Fix nested subform settings

Form settings were not being maintained when subforms are involved. If a subform changed a form setting, the parent form would inherit the new value from the subform after the subform was rendered.

I'm assuming the reverse-inheritance wasn't an intended behavior. This patch saves and restores form settings as a stack so that parent forms have their original state after a subform ends.

Let me know if you want this squashed.