update form and function to manage document type