diff --git a/frontend/src/features/documents/components/DocumentForm.tsx b/frontend/src/features/documents/components/DocumentForm.tsx index 3af4775..f2ed139 100644 --- a/frontend/src/features/documents/components/DocumentForm.tsx +++ b/frontend/src/features/documents/components/DocumentForm.tsx @@ -31,8 +31,8 @@ export const DocumentForm: React.FC = ({ onSuccess, onCancel }) => { - const [documentType, setDocumentType] = React.useState( - initialValues?.documentType || 'insurance' + const [documentType, setDocumentType] = React.useState( + initialValues?.documentType || '' ); const [vehicleID, setVehicleID] = React.useState(initialValues?.vehicleId || ''); const [title, setTitle] = React.useState(initialValues?.title || ''); @@ -152,6 +152,10 @@ export const DocumentForm: React.FC = ({ setError('Please select a vehicle.'); return; } + if (!documentType) { + setError('Please select a document type.'); + return; + } if (!title.trim()) { setError('Please enter a title.'); return; @@ -337,7 +341,9 @@ export const DocumentForm: React.FC = ({ value={documentType} onChange={(e) => setDocumentType(e.target.value as DocumentType)} disabled={mode === 'edit'} + required > +