Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Interactive Card Details

jmahamed 370

@jmahamed

Desktop design screenshot for the Interactive card details form coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


I'm having a bit of trouble with the form validation any help would be appreciated

Community feedback

@noutcheu1

Posted

can you please describe what was your probleme ?

0

jmahamed 370

@jmahamed

Posted

my problem was that the form would submit and then show the error messages after a few clicks. For example I leave everything blank and try to submit it would take a few clicks for the errors to show up and the form will have submitted anyway. i want to fix that @noutcheu1

0

@noutcheu1

Posted

@jmahamed I your probleme is you'are not stop the submit of your form just use this pattern first of all define a ID on a form like this

          <form action="#form-card" id="Myform" method="get">
         // .... //
          </form>

and in a js file get this id

let form =  document.querySelector("#Myform");

add an new event when you submit form whit addeventlistener methode

form.addEventListener("submit", (event)=>{
    event.preventDefault(); // this method  stop the  the form submit and then you can't do what you want 
    // stop form submission
	// add your code bellow 
      and if your form it is correct use this methode to send your your 
     if(send_form){
       
        form.submit();
    }
    }
}); 

I hope it will help you .

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord