HTML validation error

I’m having trouble with User Story #6:" If I enter an email that is not formatted correctly, I will see an HTML5 validation error " in Responsive Web Design Projects - Build a Survey Form. How do I do this??

Can you post a link to your project?

sure! warning, its a little messy :sweat_smile:

I noticed you do not have the test script in your Codepen. When I added it, you are failing many but not #6.

Make sure you are using the following test scripts file.

https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js

Ok thanks! but what is the test script?

You need to add the link above to your JS module’s pen settings under External Scripts/Pens. Just click the little grey gear on the left of the JS module.

Ok, I have added the link to my JS module’s pen settings. Nothing has happened. Did I do it right? Is anything suppose to happen?

You must click the hamburger menu in upper left and select which project you want to test.

Hint: You currently do not have a form element in your html.

hamburger menu?? What and where is that?

Oh. Never mind I found it. Thank you so much for all your help!!! :slightly_smiling_face::hugs:

That is what many refer to it as.

1 Like

please can you tell me where this menu ?

Ok, it’s working know.

you must give “email” as input type.

like this

1 Like

Hi Randell,

I am having the exact same issue. I have done everything you said, but I’m still getting the error for #6.

I’ll attach the link to my project. Could you please tell me if anything is wrong?

Thank you so much!

Randell,

I GOT IT!! I looked into Booklion’s HTML and made one change to “input type”:

<div class="form-group">
      <label id="email-label" for="email">Email</label>
      <input
             type="email"
             name="email"
             id="email"
             class="form-control"
             placeholder="Enter your email"
             required
             />
    </div>

Before, I was using “input type=“text””. I actually put “type=text” because the sample survey form was using “text” for it. Can I ask why the sample was using “type=text” and not “type=email”? What’s the difference?

The difference is that the browser will be so kind and validate the entered data before letting you click the submit button. If someone enters myemail@provider or myemail/provider.com, the browser won’t let them send the data, because those aren’t valid email addresses. For inputs with type=text, there is no such validation. The user can enter whatever he wants.

The sample btw does use type=email, assuming that you’re referring to this codepen: https://codepen.io/freeCodeCamp/pen/VPaoNP

1 Like

jsdisco,

Ah I see. I understand now. Thank you so much!

Yes, I was referring to that codepen. It does say type=“email”… I might have seen it wrong, my apologies. Thank you again!