Forms and Input Validation Quiz: Are Your Forms Robust? Quiz

  1. Required Attribute

    Which HTML attribute ensures a user cannot leave a form input field empty before submitting the form?

    1. required
    2. requiered
    3. readonly
    4. maxlenght
    5. disable
  2. Setting Character Length

    What attribute should you use on an input field to prevent users from typing more than 20 characters?

    1. maxlength
    2. maxlenght
    3. maxchar
    4. lengthmax
    5. minlength
  3. Pattern Attribute

    Which attribute allows you to specify a regular expression that an input value must match for validation?

    1. pattern
    2. patrn
    3. regex
    4. matcher
    5. title
  4. Disabling Input

    When you want to make an input field uneditable and ensure its value is not submitted with the form, what attribute should you use?

    1. disabled
    2. readonly
    3. disable
    4. inactive
    5. block
  5. Required vs. Readonly

    What is the key difference between the 'readonly' and 'disabled' attributes on an input field?

    1. 'readonly' fields are included in form submissions, while 'disabled' fields are not.
    2. 'disabled' fields can be edited, unlike 'readonly' fields.
    3. 'readonly' only affects password fields.
    4. 'disabled' is used for numbers only.
    5. There is no difference; both do the same thing.
  6. Input Type Attribute

    If you want to ensure a user enters an email address and benefit from browser validation, which input type value should you set?

    1. email
    2. e-mail
    3. mail
    4. text
    5. number
  7. Multiple Attribute

    For an input where users can select more than one file to upload, which attribute should be added?

    1. multiple
    2. multi
    3. duplicatable
    4. repeat
    5. multi-select
  8. Help for Users

    Which input attribute displays a hint or example text inside the field, which disappears once the user starts entering their own text?

    1. placeholder
    2. helptext
    3. label
    4. example
    5. autofocus
  9. Validation Feedback

    In a validation scenario, what does the 'title' attribute do on an input field that has a 'pattern' specified?

    1. Shows a tooltip with guidance when the pattern is not matched.
    2. Sets the value of the input field.
    3. Enforces password masking.
    4. Makes the field required.
    5. Disables submissions.
  10. Disabling Browser Validation

    How can you prevent a form from performing its default HTML validation when submitted?

    1. Add the 'novalidate' attribute to the form tag.
    2. Set method='post' in the form.
    3. Use type='reset' on the submit button.
    4. Apply 'readonly' to all fields.
    5. Add 'novalidation' to each input.