Survey Form won't pass tests

Hello! I have made a basic form that only passes 9/17 of the tests despite working perfectly fine. I can’t work out why it isn’t passing.

I would greatly appreciate any help. :slight_smile:

https://codepen.io/vanweerden/pen/ydMqep

So if you click on the button that says 9/17, it actually gives you a pretty comprehensive report of your test results for each one, whether pass or fail.

In your specific case, here are the errors:

  1. the ‘name’ field should be required.
  2. the ‘email’ field should be required.
  3. the field you’ve given the id of ‘age’ should be changed to an id of ‘number’ (the tests hook into specific id’s).
  4. checkboxes are grouped by name, as they should be, but none of them have a ‘value’ attribute.
  5. radio buttons, same as above. They are ‘input’ els, with no ‘value’ assigned to them.
<label>Do you like cheese? <input type='checkbox' name='iLikeCheese' value='why yes I do' /></label>

Note that in the above example, I have assigned the checkbox input an explicit value. When that option is selected, that is the value that will be submitted with the form.

Take a look at that report, you don’t need to be wandering in the dark. :wink:

Thanks for the reply!

I thought I had added ‘value’ to those input elements. Oops! Sorry, should have gone through it in a bit more detail.

All fixed now. Thanks again!

1 Like