JavaScript Form Validation | How to Validate a Contact Us Form

Поделиться
HTML-код
  • Опубликовано: 6 июн 2024
  • Javascript / js form validation is an important feature to have in your websites so users know what and how to fill in forms. In this tutorial we're going to learn how to add form validation on the browser.
    00:00 - Intro and Overview
    03:47 - Contact Us Banner
    05:54 - Name Input & Styling
    10:17 - Submit Button & Styling
    13:10 - Validate the Name Input (Javascript)
    18:31 - Submit Form
    19:30 - Thank You Message
    20:50 - Additional Inputs
    github.com/codyseibert/youtub...
    ------------
    I'm a full stack web developer who has been in the industry since 2013. There is a lot of things I have learned along the way and I'd like to share that knowledge with anyone wanting to learn!
    like this video if you found it useful and would like to see more videos of the same content.
    subscribe to my channel if you are trying to improve your abilities as a web developer, software engineer, or even if you are just learning to code.
    Don't forget to turn on those bell notifications!
    Book mark these links!
    Twitter / codylseibert
    Discord / discord
    GitHub github.com/codyseibert/youtube

Комментарии • 64

  • @ishimweisaac1019
    @ishimweisaac1019 2 года назад +3

    This is my first time to see your tutorial but you explain things very well and you include best practice as well. Keep that energy and produce more tutorial.

  • @dai180293
    @dai180293 3 года назад +1

    Wow,
    I am still new to front end but this tutorial is amazing! Extremely helpful 🙏

  • @greendragon0009
    @greendragon0009 2 года назад +1

    Nice voice. Vanilla JS is always the best. The info about disabling the cache while your working is freaking brilliant. I've had that problem before. It can really waste your time while debugging. Never knew this easy fix. Thanks for the learnin'. :)

  • @vahesevachyan9399
    @vahesevachyan9399 3 года назад +1

    under rated channel, definitely worth subscribing.

  • @MathiasKjeldsen
    @MathiasKjeldsen Год назад

    You might have just saved my exam. Thanks champ, nice project.

  • @muhammadbashirmuhammad5529
    @muhammadbashirmuhammad5529 2 года назад

    Thanks, for this video!

  • @1917finches
    @1917finches 2 года назад

    Thank you very much! You just saved me.

  • @martynasbucinskas
    @martynasbucinskas 3 года назад

    Thanks! Great tutorial man.

  • @DungNguyen-jx4lr
    @DungNguyen-jx4lr 3 года назад

    I tried your code out and it worked!.so thank you!.You should do more videos like this!

  • @anargyrosstylidis2595
    @anargyrosstylidis2595 3 года назад +3

    I've been learning a lot the past 4 months from your videos. I wonder if you could do some simple React projects! Hope everyone in your family is healthy or will be healthy soon! Thanks a lot for your videos they've been really helpful.

    • @WebDevCody
      @WebDevCody  3 года назад +1

      Glad you enjoy the videos. Do you have a suggestion or idea of what you want built in react? If you send me an idea of a "simple react project" I may be able to make a tutorial about it.

    • @anargyrosstylidis2595
      @anargyrosstylidis2595 3 года назад

      Hmmmm.. maybe a weather app?

  • @priyankakakkar4603
    @priyankakakkar4603 3 года назад

    really nice video.... thanks again

  • @solmonzon1810
    @solmonzon1810 2 года назад

    Increible, excelente explicacion! me fue de gran ayuda
    Gracias :)

    • @WebDevCody
      @WebDevCody  2 года назад +1

      I’m glad you found it helpful!

  • @mohamedizouaghn2597
    @mohamedizouaghn2597 3 года назад

    thank you for everything

  • @user-np6kj8pl6n
    @user-np6kj8pl6n 2 месяца назад

    Thank you !

  • @rafaelrodrigues1871
    @rafaelrodrigues1871 3 года назад

    Obrigado, aprendi bastante.

  • @TheCodingOdyssey
    @TheCodingOdyssey 3 года назад +1

    Talking about input boxes with boxes in the background! Totally in the zone ha ha

    • @WebDevCody
      @WebDevCody  3 года назад +2

      It’s the only way to live my friend

    • @TheCodingOdyssey
      @TheCodingOdyssey 3 года назад

      @@WebDevCody ha ha don't doubt it.

  • @deborahakong3155
    @deborahakong3155 2 года назад

    Wow! Did you just code with your baby. Incredible works , thanks lots

  • @priyankakakkar4603
    @priyankakakkar4603 3 года назад +1

    hey your explaining all lines in a simple way its really understanding , and please explain more perfectly every lines , so you can be a another Brad in youtube, your voice also strong. post more good explained videos . thanks

    • @WebDevCody
      @WebDevCody  3 года назад

      Got any more video ideas? I’m running out of ideas lol

    • @priyankakakkar4603
      @priyankakakkar4603 3 года назад +1

      ​@@WebDevCody Please make all videos only in vanilla javascript
      Please explain all programming lines perfectly, what this function do etc., each and every line perfectly....
      Make the Logic to understand...
      Don't run. Don't talk fast.. Lot of youtubers running like they going to miss train...
      ->Save images by clicking button
      ->Copy Text by clicking button , text field and without text field both you can make- When copy done button went to tell its copied
      ->Doc converter- copy, past text file in the text field and save that to .doc, .text or .pdf format in vanilla javascript
      ->save youtube videos by selecting format .mp4, .mkv, and 480, 1080 etc
      ->Advance Image editor tool , pencil, etc with save button
      ->Upload bulk images, after upload client can delete also , want to provide a X delete on top right so client can delete again+preview all images in full view
      ->upload images +crop images with save button
      ->upload images +resize images, reduce size+save button
      ->Responsive Navbar(hamburger) with Slider and text in vanilla javascript (do both in a single video navbar+ slider)
      ->Carousel - in vanilla javascript
      ->Create a full business website or portfolio in vanilla javascript
      ->Create a simple ecommerce website in vanilla javascript
      navbar, product listing , Footer - it a very simple ecommerce site
      ->Moving brand logo section (every 2000 milli sec) in vanilla javascript
      ->create calendar- in that clients can save any notes to celebrate and if u can add time also

    • @kingakalinowska7854
      @kingakalinowska7854 2 года назад

      @@priyankakakkar4603 I think the same :)

  • @codito7388
    @codito7388 3 года назад +3

    Hey buddy you are back! Hope everything fine with your family!

    • @WebDevCody
      @WebDevCody  3 года назад +1

      Thanks! we are hanging in there!

  • @skunkrat923
    @skunkrat923 3 года назад +4

    Very useful video. However one tip for the future. Your camera window is blocking the code. I would recommend to moving it to right corner or reduce the size of it

    • @WebDevCody
      @WebDevCody  3 года назад +2

      Thanks for the feedback! I’m making an effort to hopefully not block code anymore

  • @karacowles5624
    @karacowles5624 3 месяца назад

    anyway you could add what comes after the const re = for the isValidEmail and isValidPhone?

  • @BuZZra01
    @BuZZra01 2 года назад

    Thanks for the source code bruv!!!!!!11

  • @AJPHIL-bt4me
    @AJPHIL-bt4me 9 месяцев назад

    if you are sending to an email how do you have 2 onSubmits on the onClick event that takes in validation and email submission

  • @jeffgeter3106
    @jeffgeter3106 6 месяцев назад

    I don't see where you included link to get the regex expression you pasted into the code.

  • @zachfenton608
    @zachfenton608 2 года назад

    Excellente! The problem I am having is that phone number for some reason is showing valid even when it's blank same with the comment. I want to see the continuation of a fetch request and then a request to go back to the home page.

  • @madebytl
    @madebytl Год назад

    Hi, if I want the form after submit it direct to open other link. How to do it? Thank you.

  • @happensiphomathebula712
    @happensiphomathebula712 2 года назад

    👌

  • @tashalorenz1982
    @tashalorenz1982 3 года назад

    Hey! this video was super helpful. Everything was working well for nameInput and stopped working after i added more inputs. i got very confused when you added 'elm'. just wondering what elm is?

    • @WebDevCody
      @WebDevCody  3 года назад +2

      So I made a helper function that I could pass the dom element which I used the variable named elm to represent.

    • @tashalorenz1982
      @tashalorenz1982 3 года назад

      ​@@WebDevCody Maybe I missed it in the video, ill go back. what was the helper function? - also thanks for getting back super quick :)

  • @alessandrocolombini1966
    @alessandrocolombini1966 3 года назад

    I used this code but it returns me the following error:Uncaught TypeError:
    Cannot read property 'classList' of null
    at resetElm (modulo-conatti.js:31)
    at Array.forEach ()
    at validateImputs (modulo-conatti.js:43)
    at HTMLFormElement. (modulo-conatti.js:70)
    I have no idea how to fix it... maybe you neither because I adapted your code to my form...

  • @henryherrera3362
    @henryherrera3362 3 года назад

    HI I want to ask what can cause error on validation for some costumers . I am in Macedonia and form works perfectly but I got report that form generates error for clients from USA? is this possible and how to fix this problem ?

    • @WebDevCody
      @WebDevCody  3 года назад

      I haven’t heard of anything like that before. You’d want to find what browser, version, and operating system they used

  • @atifahmed9253
    @atifahmed9253 2 года назад

    When I input the name and click submit it says name required still anyone kno wjy

  • @5saydeez5
    @5saydeez5 3 года назад +3

    baby-wearing whilst coding? RESPECT G. instant sub

    • @WebDevCody
      @WebDevCody  3 года назад +4

      haha yeah it kills my back but it's my only way to find time to make videos for you all

  • @bensonyeboah297
    @bensonyeboah297 3 года назад

    Hey Buddy, will be glad if you can please reply me...can u please do a video on mern stack auth? with Redux and not context ? please.....especially the frontend end auth with the jwt(redux not context api) please

    • @WebDevCody
      @WebDevCody  3 года назад +1

      I can add it to a list of video ideas if you give me a simple idea of what you want to see built. Do you just want an overview of how you setup authentication and authorization and maybe put authorization behind an endpoint?

    • @bensonyeboah297
      @bensonyeboah297 3 года назад

      @@WebDevCody yes please, how to actually use the jwt sent from the backend to protect routes in the frontend

    • @bensonyeboah297
      @bensonyeboah297 3 года назад

      Thanks alot for reaching out sir

  • @Rahul-xm1vn
    @Rahul-xm1vn 2 года назад

    Sir what's the condition for radio button please reply

    • @WebDevCody
      @WebDevCody  2 года назад

      What do you mean?

    • @Rahul-xm1vn
      @Rahul-xm1vn 2 года назад

      @@WebDevCody sir I can't add a function on form tag like onsubmit () function.

    • @WebDevCody
      @WebDevCody  2 года назад

      @@Rahul-xm1vn you should be able to do

  • @alexanderlarrybrown2434
    @alexanderlarrybrown2434 2 года назад +1

    you've used yourself video to block the code you've written

  • @timtech9361
    @timtech9361 2 года назад

    Are you recording from your closet bro?

    • @WebDevCody
      @WebDevCody  2 года назад +2

      Yes lol

    • @chrissame
      @chrissame Год назад

      🤣😂

    • @chrissame
      @chrissame Год назад

      It's how a true programmer works, in the closet or the basement🤣🤣🤣🤣