Loading workspace…

Contact Form

Michal GrzegorczykSenior Front End Engineer, Ofair
Languages

Building forms is a common task in front-end development. In this exercise, we will build a basic "Contact Us" form, commonly seen on marketing websites for visitors to ask questions or provide feedback.

Requirements

  • The form should contain the following elements:
    • Name field.
    • Email field.
    • Message field. Since the message can be long, a <textarea> will be more suitable.
    • Submit button.
      • Contains the text "Send".
      • Clicking the submit button submits the form.
  • Implement the form entirely in HTML. Keep the supplied submission helper; it handles the request and displays the response. Do not add JavaScript or framework-specific form logic.
  • There is no need to do any client-side validation on the fields. Validation will be done on the server side.

Submission API

The supplied helper reads the form fields and sends a JSON POST request to https://questions.greatfrontend.com/api/questions/contact-form with the following fields in the request body: name, email, message.

If all the form fields are correctly filled in, you will see an alert containing a success message. Congratulations!

Notes

You only need to write HTML for this question. Focus on form controls, labels, field names, and submission attributes.

Changelog

  1. HTML and the supplied submission helper

    Build the form in HTML and keep the supplied helper. The description explains that the helper reads the fields, sends the JSON request, and displays the response.

  2. Submission endpoint moved

    The supplied form helper posts to the question API at questions.greatfrontend.com. The description and official solutions were updated to use that host.

  3. Form submission in the Vue starter

    The Vue starter imports the submission helper under the name used by the form so it can submit successfully.