added dynamic preview and conditional submit button