Enjoy 20% off all plans by following us on social media. Check out other promotions!

Contact Form

Author
Yangshun Tay
Yangshun TayEx-Meta Staff Engineer
Languages
HTML
Difficulty
Easy
Recommended duration to spend during interviews
15 mins
Users completed

Building forms is a common task in Front End. 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 on the submit button submits the form.
  • The form and submission should be implemented entirely in HTML. Do not use any JavaScript or framework-specific features for this question.
  • There is no need to do any client-side validation on the fields. Validation will be done on the server side.

Submission API

Upon submission, POST the form data to https://www.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 up, you will see an alert containing a success message. Congratulations!

Notes

You do not need JavaScript for this question, the focus is on HTML form validation and submission.

Companies

Premium FeaturePurchase premium to see companies which ask this question.
View plans
View solution