Describe the bug
The Contact Form page (views/contact.ejs) is missing client-side validation for the Subject dropdown.
While the Name, Email, and Message fields have client-side validation and the required attribute, a user can submit the form with "Select a subject" still active. This bypasses the client-side check and triggers a backend Express validation error (Subject is required.) instead of blocking the submission on the client side.
To Reproduce
- Navigate to
/contact.
- Fill in the
Name, Email, and Message fields.
- Leave the
Subject dropdown set to its default option ("Select a subject").
- Click Send Message.
- Observe the validation error displayed at the bottom of the form, returning from the server validation.
Expected behavior
The form should prevent submission on the client side and prompt the user to select a valid subject before hitting the API endpoint.
Proposed Solution
- Add the
required attribute to the <select> tag in views/contact.ejs:
<select id="subject" name="subject" required>
Describe the bug
The Contact Form page (
views/contact.ejs) is missing client-side validation for the Subject dropdown.While the
Name,Email, andMessagefields have client-side validation and therequiredattribute, a user can submit the form with "Select a subject" still active. This bypasses the client-side check and triggers a backend Express validation error (Subject is required.) instead of blocking the submission on the client side.To Reproduce
/contact.Name,Email, andMessagefields.Subjectdropdown set to its default option ("Select a subject").Expected behavior
The form should prevent submission on the client side and prompt the user to select a valid subject before hitting the API endpoint.
Proposed Solution
requiredattribute to the<select>tag inviews/contact.ejs: