submit validation and preview functionality