Help with survey form - arkieflier

I seem to have a conflict between User Story #4 and #10. If the test suite passes #4, it fails at #10.

#4 plainly says to use id=“name. #10 talks about using id=“name-label

If I use id=“name-label” in <label… and <input… #10 passes but #4 fails.
If I use id=“name” in <label… and <input… both #4 and #10 fail, even though #4 specifically asks for id=“name”.

Regardless of the term I use, I get a warning (Fill out this field) that the field needs an entry. I think that comes from the ‘required’ (HTML5?) attribute.

BTW, I can’t seem to find the way to start a new thread/question/post. :headbash:

1 Like

This user story

User Story #4: Inside the form element, I am required to enter my name in a field with id="name" .

is talking about a field inside of the form element.

This user story

User Story #10: For the name, email, and number input fields inside the form I can see corresponding labels that describe the purpose of each field with the following ids: id="name-label" , id="email-label" , and id="number-label" .

is talking about the label element for the above mentioned field. The field and its label are separate (but related) things.

Never mind. I finally figured out how to pass both #4 and #10.

But I don’t understand the difference between “id=” in a <label> and the same attribute in the <input>. Are these differently named id’s mainly for javascript? :thinking:

1 Like

It has nothing to do with Javascript. They are different elements. Giving the exact same id to two different elements would be confusing.

1 Like

I just noticed that the post I replied to was “split”. I entered the following, since I could not delete my original post.

Never mind. I finally figured out how to pass both #4 and #10.

But I don’t understand the difference between “id=” in a <label> and the same attribute in the <input> . Are these differently named id’s mainly for javascript? :thinking:

Thanks! If I am listed as an ‘author’ of a post, I can then edit any posts I make in that thread.

I understand that (I thought! :blush: ) about “one id [label] per page”. It’s a basic CSS/HTML idea! Somehow, I was getting confused<- by ‘id’ and ‘for’ in a label and an ‘id’ and ‘name’ in the input.

My ‘state of residence’ is “confused”! :rofl:

Use “min” and “max” in the Input.

In my form, I have two fields that accept numbers.
One includes both the “min” and the “max” attributes.

However, the other number field can have practically any number. I set the “min” to 0 (zero), but I see no real need to set a “max”. Of course, to get the test suite to pass, I may have to insert an irrelevant number? :thinking:

As I read it, only the number field that is being checked by the test suite (the one from User Story #7) needs the validation with both a min and a max. There should only be one field with the id of “number”.

User Story #7: Inside the form, I can enter a number in a field with id="number" .

User Story #9: If I enter numbers outside the range of the number input, which are defined by the min and max attributes, I will see an HTML5 validation error.

I had only one field with the “id=number”. I added a ‘max=“50000”’ to the other place I needed a number and that allowed the test suite to pass. The number refers to the number of flight hours a pilot has, “50,000” should cover the majority of pilots!

BTW, I have passed (17/17) the test suite now. The last edit required I put the “dropdown” id in the input(select) rather than in the Label where I had it. Perhaps I’ll try to always add “XYZ-label” to all id’s in a Label and put an id of “XYZ” in the input. Oh well…

Thanks again!! :+1:

1 Like

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