helper function to format popups, clear the form on save (to prevent accidental re-entries)