add form validation and form submit logic