javascript implemented for form preview, edit, and submit