Survey form problems!

it says that i fail 6 of the 17 tests because my ids arent in my form elemnts but i did the forms like theirs on the example and theirs is right but apparently mine is wrong idk what im missing or doing wrong can someone please help
https://codepen.io/lapczdenny/pen/bGqWxrr

When I look at your failing tests, I see this test failing:

  1. If I enter non-numbers in the number input, I will see an HTML5 validation error.
    Number field should be HTML5 validated : expected ‘text’ to equal ‘number’ AssertionError: Number field should be HTML5 validated : expected ‘text’ to equal ‘number’

When I look in your code, I see this:

    <input
           typer="number"
           name="age"
           id="number"
           min="16"
           max="101"
           placeholder="Age"
    </input>

There is a rather glaring typo there. When I fix that, the test passes.


When I look at the next failing test, I see:

  1. Inside the form element, I can select an option from a dropdown that has corresponding id=“dropdown”.’
    The select field with id=“dropdown” is not inside the form element : expected 0 to be above 0
    AssertionError: The select field with id=“dropdown” is not inside the form element : expected 0 to be above 0

When I look at your code:

     <select id="dropdown" name="happiness" required>
       <option disabled selected value>Please Select Happiness Level</option>
       <option value="super-excited">Super Happy</option>
       <option value="kinda-excited">Kinda Happy</option>
       <option value="ehh">Ehhh it was alright.</option>
       <option value="kinda-sad">Kinda Sad</option>
       <option value="sad">Sad</option>
       <option value="depressed">Depressed</option>
     </select>

I see that that does seem to meet the requirements. If I cut and paste that into a passing project, that passes. When I cut and paste the select section from a passing project into your project, it fails. That suggests to me that there are some problems with the code that surrounds it.

Looking through your code, I see a lot of little errors: I think every one of your inputs is malformed, you have more closing divs than opening, you have several things with the id “checks” (ids must be unique), etc.

I would also suggest formatting your code better as you go - it will save you so much time in the long run. If you look in the right corner of the HTML pane in codepen, there is a little pulldown menu. There you will find things like “Format HTML” - use it and get used to coding that way. Eventually it will just become habit.

There is also an “Analize HTML” option there. That is a good way to find errors like above. You can also go to places like this, select the “Validate by Direct Input” option and paste your code in and get an analysis. (Note that the first 3 errors or so will just be because you are doing this in codepen.)

I would suggest fixing all the HTML errors before trying to analyze all the test suite errors. Improper HTML can keep the test from being able to parse the HTML properly.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.