Knowledge check: Declaring form elements

Knowledge check: Declaring form elements

  1. You are building a calendar web application; which of the following input types can be used? Select all that apply.

    •   <input type="month">
      
    •   <input type="week">
      
    •   <input type="year">
      
    •   <input type="date">
      
  2. You want to define a dropdown of selectable options. However, you also want users to be able to input their responses as well. Which of the following is the most suitable form element to wrap available options?

    • select

    • datalist

    • output

    • fieldset

  3. For the following code block, what is the most suitable input type that will ensure that only a single option is selected?

     <form>
        <input type="----" id="alpha" name="letters" value="Alpha">
        <label for="html">Alpha</label><br>
        <input type="----" id="beta" name="letters" value="Beta">
        <label for="css">Beta</label><br>
        <input type="----" id="gamma" name="letters" value="Gamma">
        <label for="javascript">Gamma</label>
     </form>
    
    • checkbox

    • submit

    • radio

    • button

  4. When defining a form, which element is almost always defined?

    • <legend>

    • <input>

    • <output>

    • <option>

  5. True or false. The following form element will clear the form validation errors.

     <input type="reset">
    
    • True

    • False

  6. A developer has added the following input element to a HTML form. What client-side validation is applied? Select all that apply.

     <input type="email" required minlength="4">
    
    • The user input must be in an email address format

    • The user must provide a value to the input field

    • The maximum length of the user input must be 1024 characters

    • The minimum length of the user input must be 4 chararacters.