move form setData, config DB fetch, and display-success logic to where it is used in order to avoid needlessly computing it when it will not be used