Failing tests for building validation rules in a different way

Tell us what’s happening:
Hello all, first of all thanks for your attention!

Here you can check my entire code for the “Build a Form Page” challenge: https://codepen.io/marcuscatan/pen/bGVNgqK?editors=1100

I’m failing in 3 challenges, the validation field. The thing is… My validation is working just fine, but I guess freeCodeCamp wanted me to use a different sort of validation… My first question is: should I bother with this or since it’s working I should just move-on?

Your code so far
If I should bother here’s my validation:

    <label id="name-label">Name<br>
    <input 
          id="name" 
          type="text" 
          class="InputG1" 
          name="Name" 
          placeholder="  Enter your name" 
          **pattern="[A-Za-z\" "]{4,40}" **
**          title="Please type in your name (only letters allowed, at least 4 letters)" 
          required**    
    /></label>

Note: Only attributes related to validation are pattern, title and required.

Thanks again and cya o/
Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36.

Challenge: Build a Survey Form

Link to the challenge:

Hi there,

The reason it is not passing the tests is because you need to give each of your inputs (name, age , email) an attribute type=" so for email you would add type=“email” and age would be type=“number”, and then a text attribute for name.

These will replace your pattern regex so you wont need the pattern attributes.

Good luck :smiley:

1 Like

it may interest you search on google “falsehoods programmers believe about names”

1 Like

Thanks so much for answering!

I did add the name attributes as you suggestes, still failing the tests though:

    <label id="name-label">Name<br>
    <input 
          id="name" 
          type="text" 
          class="InputG1" 
          name="Name" 
          placeholder="  Enter your name" 
          type="text"
          title="Please type in your name (only letters allowed, at least 4 letters)" 
          required    
    /></label>
    <br>
    
    <label id="email-label">Email<br>
    <input 
          id="email" 
          type="text" 
          class="InputG1" 
          name="Email" 
          placeholder=" Enter your Email"
          type="email"
          title="Please type in a valid e-mail"
          required
    /></label>
    <br>
    
    <label id="number-label">Age (Optional)<br>
    <input type="integer" 
      id="number" 
      class="InputG1" 
      name="Email" 
      placeholder="  Age" 
      type="number"
      title="Please inser your age"
      required
    /></label>
    <br>

Hey man,

I think one problem might be that the labels and the inputs are not pointing together.
The <label id = "number-label"> and the <input name = 'same as the id for the label'> Also check your HTML again, you got a few mistakes in it bud,
Hope this helps

It’s still failing because you also have type text in all 3 but you can remove them from each one so you only have a type text in the name one, number in the age one and email in email one :smiley:

1 Like

It worked, you’re amazing. Ty!!!

That was an interesting reading, ty!