Form Validation Easy Using HTML And CSS Only

Поділитися
Вставка
  • Опубліковано 26 лис 2024

КОМЕНТАРІ • 148

  • @lundeveloper
    @lundeveloper  2 місяці тому +22

    Form validation is eazy with HTML and CSS. Don't forget to like and subscribe to the channel to continuously update interesting videos about programming and web design 😍

    • @manthankanani188
      @manthankanani188 2 місяці тому

      Extend this with html attr pattern and boom!!

  • @lundeveloper
    @lundeveloper  2 місяці тому +26

    With just over 10 lines of CSS, we can validate the form easily and beautifully

    • @anuvabkumarrit4669
      @anuvabkumarrit4669 2 місяці тому

      Not possible for complex I suppose, like those with options and specific regular expression

    • @dmitrybelov5703
      @dmitrybelov5703 2 місяці тому +1

      How about :user-invalid / :user-valid? More suitable pseudo

  • @gmarsenopoulos
    @gmarsenopoulos 2 місяці тому +32

    Amazing video!!
    My answer: If you put :not(placeholder-shown) then the button would be disabled only when the user enters invalid data in the inputs. Without it, you can disable the button from the start if any of the input fields are invalid.

    • @lazy-hero.
      @lazy-hero. 9 днів тому

      Yep your right 👍🤍

  • @lundeveloper
    @lundeveloper  2 місяці тому +12

    Topic for next video: What neither Grid nor Flex CSS can do? Subscribe to be the first to see it 😍 ✅✅

  • @egadirgaa
    @egadirgaa 2 місяці тому +6

    i love how you make html and css look so awesome

  • @freakfreak786
    @freakfreak786 15 днів тому

    I love how you admire simplicity. For me, that makes you a top tier channel

  • @mateod700
    @mateod700 2 місяці тому +20

    i love this sound effects throught your videos

  • @utsavjaiswal007
    @utsavjaiswal007 2 місяці тому +4

    Because we want button should be disabled by default. When user enters correct data then it should be enabled. BTW I love your content... The way you showed the power of html and css... 🔥

  • @MarkupMaverick
    @MarkupMaverick 2 місяці тому +8

    Great video.👍Consider using the pseudo classes :user-valid and :user-invalid, that will make the placeholder trick obsolete.🙂

    • @lundeveloper
      @lundeveloper  2 місяці тому +6

      Thank you bro, but The reason I haven't been introduced to :user-valid in this video is because many browsers are not yet supported so it cannot be used in real projects.

  • @social_klauts
    @social_klauts 27 днів тому

    I Love your Videos. Great Work.

  • @drumlinbeatpaul
    @drumlinbeatpaul 7 днів тому

    Great video, thank you. Simple and does just what I need.

  • @muhammadadnanrazaqadri
    @muhammadadnanrazaqadri 2 місяці тому +2

    You are Great Bro Thanks for this Type Of Content Please Continue making this type of video

  • @glennwarindu4580
    @glennwarindu4580 2 місяці тому

    BRO😱😱😱I marvellled once I came accross your channel you are a genius thank GOD for you

  • @HuynhLuong227
    @HuynhLuong227 Місяць тому

    wow, pro tips, thanks for sharing

  • @hameeeed5992
    @hameeeed5992 2 місяці тому +7

    Great video.

  • @thezaidushaikh
    @thezaidushaikh 2 місяці тому

    Your Content is next level

  • @philathea
    @philathea Місяць тому

    From the way you present your videos it's like you will be good movie script writer or game developer, you damn good ❤

  • @tolgaflashtr2855
    @tolgaflashtr2855 2 місяці тому

    That's an awesome trick 💯💯

  • @redswordz9131
    @redswordz9131 2 місяці тому

    this is very handy! i didn't know 'required' existed in html! really good and straightforward as always.

  • @roshanaslam7480
    @roshanaslam7480 2 місяці тому

    Great video keep it up

  • @SwitchSwift12
    @SwitchSwift12 2 місяці тому

    Amazing content 😊

  • @luisdavidmartinezfundora8224
    @luisdavidmartinezfundora8224 2 місяці тому

    This is just amazing ❤

  • @vanshchauhan5340
    @vanshchauhan5340 2 місяці тому +1

    100k soon ❤

  • @georgikyshenko4380
    @georgikyshenko4380 2 місяці тому

    This channel is gold!

  • @emmaeli-m2u
    @emmaeli-m2u 2 місяці тому

    G.O.A.T. [greatestOfAllTime]

  • @DavideMaiolo
    @DavideMaiolo 2 місяці тому

    Love that trick with the placeholder shown ! didnt know this is possible :D
    I guess we dont want that on the submit button since the submit button should also be shown as disabled no matter if the placeholder is shown or not. We only want to loose the disabled look once all inputs are valid

  • @peterbaerts
    @peterbaerts 2 місяці тому

    Nice video
    Small hint, with the pattern and title Attributes, any regular expression can be used to validate input. 😊

  • @PicSta
    @PicSta 2 місяці тому

    Man, another great video with awesome, easy and entertaining valuable content. Thanks for your good work again. Have a nice day, Hoangho!

  • @amitmallick4915
    @amitmallick4915 2 місяці тому

    I have been watching your videos since you started the channel. Your channel is a real gem. I kindly request that you make a complete multifunctional website using only HTML and CSS.

    • @lundeveloper
      @lundeveloper  2 місяці тому +1

      Thank you very much, I will keep trying

  • @besuccessfull1891
    @besuccessfull1891 2 місяці тому

    Your designs are beautiful please make a video for that tooo, how do you choose the design plzz a make a video on design course🙏🙏

  • @keshav2kumar
    @keshav2kumar 2 місяці тому

    Very nice

  • @jayvee-official
    @jayvee-official 7 днів тому

    hey.. I thought it might be useful for my project 👍

  • @sol____-_-
    @sol____-_- 2 місяці тому

    Nice.

  • @franckngoubounkou9930
    @franckngoubounkou9930 2 місяці тому

    You are very dangerous .High level .

  • @okforcoding
    @okforcoding 2 місяці тому

    Great video bro ❤

    • @lundeveloper
      @lundeveloper  2 місяці тому +1

      Thank you for watching my content brother ❤️

  • @MustaPha-s4i
    @MustaPha-s4i 2 місяці тому

    The best i love your vidéo

    • @lundeveloper
      @lundeveloper  2 місяці тому

      😍😍😍😍 Thanks for watching my content ❤️

  • @tanvirkabir47
    @tanvirkabir47 2 місяці тому

    Just wow 🤯

    • @lundeveloper
      @lundeveloper  2 місяці тому +1

      Thank you brother 🤤🤤🤤

  • @AirmanCS
    @AirmanCS 2 місяці тому

    First I love this channel, second pls do a image comparison only using CSS that looks nice like the java query input event ones, if not clear the ones that have like a line in the middle and you move it to see 2 images one on top of each other, also I would love if you consider using your real voice even if it is the thickest of accents ever, if it is hard I would add some subs but there is something about the AI voice that throws me off a bit 😅

  • @denizorsel1029
    @denizorsel1029 2 місяці тому +1

    I like the effort you put into this video but doing form validation with html and css only makes sense for simple forms like a login interface. Let's say you want to do it on a survey form with conditions, quotas, loops and there it immediately stops making sense to push the logic on css but drive it on a platform with a focus (eg. formik etc..) Yes we would still display styled outcomes through css but the logic needs to stay in js sphere.

  • @Anonymous34958
    @Anonymous34958 2 місяці тому

    Thanks for the awesome video. Please try to make some js videos too

  • @angryllamaa
    @angryllamaa 2 місяці тому

    Now i can flex my skills to my friends

  • @JanMitLuca
    @JanMitLuca 2 місяці тому +1

    Answer: Because we want the button to be only clickable once all required inputs are valid. Empty inputs are invalid as shown in the video.

  • @BliitzPint
    @BliitzPint Місяць тому

    Answer: Because it's not necessary ;) When it's valid, it's valid :) And only then we care.
    Nice trick by the way. Is "placeholder-shown" widely supported by the browsers?
    How about working with ":has". Would that make it even easier?

  • @YINREX-24
    @YINREX-24 2 місяці тому

    bro you are great

  • @LuffyD-u7l
    @LuffyD-u7l 2 місяці тому

    Nice

  • @johnlloydtenido6915
    @johnlloydtenido6915 2 місяці тому

    IMO.This is more complicated than using javascript :D

  • @yourherper
    @yourherper 2 місяці тому +1

    I love your channel, tell me how many years you spend with css and html?

    • @lundeveloper
      @lundeveloper  2 місяці тому +1

      Thank you very much, even though this channel has just been established, please believe in the content I share.
      I learned to code HTML & CSS when I was 13 years old (2010)

  • @mr.masolov1611
    @mr.masolov1611 23 дні тому

    Great idea, but has a HUGE flaw called "insect element"

  • @andphysics4318
    @andphysics4318 2 місяці тому

    please make a series of backend programming I want to learn this from you.

    • @lundeveloper
      @lundeveloper  2 місяці тому +1

      I Will

    • @andphysics4318
      @andphysics4318 2 місяці тому

      @@lundeveloper thank you master , I'll be waiting for the series

  • @mattdaus5715
    @mattdaus5715 2 місяці тому +5

    This is an oversimplification of most form validation. It's considered best practice not to disable the submit button but allow users to fail and tell them why their submission was invalid. Something not possible with CSS unless you have some very specific CSS selectors, even then there's accessibility to take into account but based on the colors in the design it looks like that wasn't a consideration for this client. I think there is a use for simple validation like this but for complex sites or apps this usually won't cut it.

  • @alin7295
    @alin7295 2 місяці тому

    My Answer: You have not used the :not(:placeholder-shown) for the button as the written style will only be applied whenever the user writes something in the input .
    My Suggestion for other viewers: It(using :not(:placeholder-shown)) can also be useful in different cases. It helps us to create a default custom style of the button,e.g., to set the default color not to be red

  • @tibba69
    @tibba69 Місяць тому

    In a form with failed validation, how can I block the submit button if it is BEFORE all the inputs?
    You only show when submit button is after all inputs.
    Great video by the way.

  • @treshi
    @treshi Місяць тому

    Answer: Because you're changing the button relative to the input:invalid which doesn't require you to specify :not since you're not changing anything on the input field and the button only needs to know if the field is valid or invalid. (I guess )

  • @kodeeshwarar2301
    @kodeeshwarar2301 2 місяці тому

    I love this Simple hacks

  • @jerickojamestano626
    @jerickojamestano626 2 місяці тому

    thanks

  • @FullStack-s8g
    @FullStack-s8g 2 місяці тому +1

    Bro use user-valid instead of valid same for invalid 😊

  • @roshplays21
    @roshplays21 22 дні тому

    HWY HWY can u teach us how u made that background please

  • @DeepJasoliya
    @DeepJasoliya 2 місяці тому +1

    Because we only want enable submit button when inputs are completely valid

  • @ionsula141
    @ionsula141 2 місяці тому

    The shopping cart script you did before was very good.
    Can I add product size option?

    • @lundeveloper
      @lundeveloper  2 місяці тому

      Yes You Can 😍

    • @ionsula141
      @ionsula141 2 місяці тому

      @@lundeveloper Hi there. can you please add this function for me? I would pay you a fee for this. I have email you with detail

    • @DinahLang-y4g
      @DinahLang-y4g 2 місяці тому

      @@lundeveloper Hi I mailed you with detail. thanks

  • @roydeljoseph
    @roydeljoseph 2 місяці тому

    This is amazing... But not gonna lie...LOW-KEY I feel bro got it out for javascript....like he finna prove it nah all that and he can do the same with CSS

  • @muhammadadnanrazaqadri
    @muhammadadnanrazaqadri 2 місяці тому

    Please Make Video On Switching Dark To Light or Light to dark mode using HTML CSS ONLY (without JS or any other language)

    • @lundeveloper
      @lundeveloper  2 місяці тому

      Of course you can, but if you only use HTML and CSS you won't be able to remember the last option the user chose. If that's not important to you, everything will be very easy

    • @muhammadadnanrazaqadri
      @muhammadadnanrazaqadri 2 місяці тому

      @@lundeveloper ok then can you make a course for js

  • @wordspace121
    @wordspace121 2 місяці тому

    Just a quick question
    You validated password with minlength attribute
    Wouldn't it be risky if someone goes to inspect element and change that attribute value?

  • @codeSlay-yv4wq
    @codeSlay-yv4wq Місяць тому

    Bro where do you find those background images

  • @mohdamir914
    @mohdamir914 13 днів тому

    You didn't use input with placeholder in last line of code in css because we already checked the validation while typing and now its successfully filled so just need to check if it is valid or not. Correct?

  • @requenz_
    @requenz_ 2 місяці тому +1

    It looks good, but the HTML code can be removed if you open the Devtools by pressing F12.

    • @lundeveloper
      @lundeveloper  2 місяці тому

      That's right, like I said at the beginning of the video. When users want to cheat, Devtools can help them pass validation not only for HTML but also for Javascript

    • @requenz_
      @requenz_ 2 місяці тому +1

      @@lundeveloper What about PHP?

    • @PicSta
      @PicSta 2 місяці тому

      @@requenz_ PHP is a server sided validation. Validation with PHP is a must, before you write data to your database. Like prevent from SQL injection or any other vulnerable content.

  • @king82823
    @king82823 2 місяці тому

    1:45 how to quick select every props 😲

  • @gandhirajs7055
    @gandhirajs7055 2 місяці тому

    because when you focus the button placeholder is gone and button turn into normal state and what happen when you enter the page what will be the submit button pointer event is none or auto?

  • @flash27s
    @flash27s 2 місяці тому

    Sir, can you please tell me, which theme of vs code are you using in this video?

    • @lundeveloper
      @lundeveloper  2 місяці тому +1

      @@flash27s This is a custom theme, you will find a video about it in the description of this video.

  • @joel-rg8xm
    @joel-rg8xm 2 місяці тому

    Uhmm :not(:placeholder-shown) ... ¿Because we want to disable the button all the time (when the text inputs are empty and when they are invalid as well)?

  • @awaken-trigger
    @awaken-trigger 2 місяці тому +1

    Is there any way to get data of gmail and numbers etc.. of users with only html, css without no backend. 😢
    Help..... please

  • @psenej
    @psenej 2 місяці тому

    what about tailwind css ?

  • @wtf_vish
    @wtf_vish 2 місяці тому

    hey bro, can you make a front-end website as a reference as i have hackathon in about 10 days. Please use html and css only.

  • @Aguinaldowagas
    @Aguinaldowagas 2 місяці тому +1

    if submit is input ? add (:placeholder-shown) : false;

  • @aluexpress987
    @aluexpress987 2 місяці тому

    Last question why you don't need not:placeholderShown because button tag has no placeholder.

  • @UAP_Clips
    @UAP_Clips 2 місяці тому

    because you need the button to be active after the placeholder is not shown

  • @jeandearme32
    @jeandearme32 Місяць тому

    I like the content, but those musical sounds are absolutely irritating

    • @lundeveloper
      @lundeveloper  Місяць тому

      Thanks for your feedback, I'm adjusting it.

  • @nirban7689
    @nirban7689 2 місяці тому

    Not add placeholder shown property at last because first time when user not enter any data submit button looks kind of disable

  • @PLAGUEDOCTOR-28
    @PLAGUEDOCTOR-28 24 дні тому

    I need a tutorial to make login page pls

  • @lucadetomi9269
    @lucadetomi9269 2 місяці тому

    Why not use ":user-invalid" instead of the more complex concatenated selector?

  • @masaratech
    @masaratech 19 днів тому

    VS Code theme name?

  • @madhavanj998
    @madhavanj998 2 місяці тому

    How to change the text "please fill this field"

  • @Crix-X982
    @Crix-X982 2 місяці тому

    Bro I was comented that why we not use :not(placeholder-shown) Then you asked this question 😅

    • @lundeveloper
      @lundeveloper  2 місяці тому

      😅😅 Please wait a moment, I believe someone will reply soon. 😍

  • @MithilaChiranjeewa
    @MithilaChiranjeewa 2 місяці тому

    Bro what is your vs code them name?

    • @lundeveloper
      @lundeveloper  2 місяці тому

      This is a custom theme by me. You will find information about it in the description of this video

  • @nobie-art
    @nobie-art 2 місяці тому

    Can't the validation issue before the user enters anything be easily fixed by using user-valid and user-invalid?

    • @lundeveloper
      @lundeveloper  2 місяці тому +1

      Yes, using user-valid would be much simpler, however there are still too many browsers that do not support user-valid. So it is not recommended to use user-valid in real projects.

  • @PicSta
    @PicSta 2 місяці тому

    A button has no placeholder shown state. Initially, we want the button only be active, when all fields are validated as correct.

  • @Rodrigo-nx4fg
    @Rodrigo-nx4fg 2 місяці тому

    Bro, the fart sound makes me happier 😂

  • @Crix-X982
    @Crix-X982 2 місяці тому

    Plz awnser your own question Because i want to know

    • @DavideMaiolo
      @DavideMaiolo 2 місяці тому +2

      I guess we dont want that on the submit button since the submit button should also be shown as disabled no matter if the placeholder is shown or not. We only want to loose the disabled look once all inputs are valid

  • @NehaV-ly5hk
    @NehaV-ly5hk 2 місяці тому

    Which theme are you using in VS code?

    • @lundeveloper
      @lundeveloper  2 місяці тому

      You can find it in description this video

  • @_MrThii
    @_MrThii 2 місяці тому

    Can you activate subtitles

  • @h3llloworld
    @h3llloworld Місяць тому

    because a button doesn't have a placeholder

  • @Nodsaibot
    @Nodsaibot 2 місяці тому

    sudden chello cords gives us anxiety lol bye

  • @KsaR-99
    @KsaR-99 2 місяці тому +1

    But you know, "a@a" is valid e-mail in html?

    • @thelfensdrfer
      @thelfensdrfer 2 місяці тому

      Because it is a valid email.

    • @KsaR-99
      @KsaR-99 2 місяці тому

      ​ @thelfensdrfer Technically yes, in practice no. All the (public) e-mail addresses requires an TLD e.g. ".com", ".net" etc. at the end. So this isn't valid public e-mail.

    • @thelfensdrfer
      @thelfensdrfer 2 місяці тому

      @@KsaR-99 why does it have to be public?

    • @KsaR-99
      @KsaR-99 2 місяці тому

      ​@@thelfensdrfer Let's say it's register form, newsletter or soever. You want public address to send verification code on correct address, or deliver newsletter. And this tutorial seems to aim web-development (and not localhost). So in short "a@a" will work on "local host" but not on -- public pages; In that case (It's not security because it is easy to workaround) to improve "required" attribute can be used in conjunction with the pattern="" attribute.

    • @thelfensdrfer
      @thelfensdrfer 2 місяці тому

      @@KsaR-99 there are more networks than localhost and the public internet. Intranets, company networks, etc.

  • @Impact_TO
    @Impact_TO 2 місяці тому

    The sounds 😭😭😭 i cant

    • @lundeveloper
      @lundeveloper  2 місяці тому

      is it bad?

    • @Impact_TO
      @Impact_TO 2 місяці тому

      @@lundeveloper no i love it. Fart sounds will never not make me laugh

  • @DanSmith-ku3wn
    @DanSmith-ku3wn 2 місяці тому

    Nice videos, but oh man these sound effects... Totally random and not classy. Please stop :(

  • @choujiakimichi
    @choujiakimichi 2 місяці тому

    No thank you...Dev tools can easily remove all forms of security from the form 😞😞😞

  • @bw-dude
    @bw-dude 2 місяці тому +1

    Had to quit after 30 seconds, that silly AI-voice and the absolutely annoying sound effects make it unwatchable for me. Why do you ruin good content with that?

  • @Wanstudio_est
    @Wanstudio_est 2 місяці тому

    Are you Mr beast

  • @bohdanvoznyi3599
    @bohdanvoznyi3599 2 місяці тому

    What is this sounds bro 😭

  • @sol____-_-
    @sol____-_- 2 місяці тому

    Nice.