Skill Test: Form Validation 3

Hi there :smiley: Hope all well. Kindly asking for assessment for my markup and JS for the 3rd skill test in this series.

Codepen here.

Thank you in advance :+1:

โ€ฆand here we go for the third task. :grin:

This exercise is nearly correct. One problem: When I make a mistake and get your custom error message and then correct my mistake, pressing the button still gives me the error message. You need a way to reset the error message when everything is correct.

If you need a hint, just ask. :slightly_smiling_face:

Michael

Hi @mikoMK,

Appreciate the fb/review. Should have had a closer look prior to submission.

.setCustomValidity() sets input validity but doesnโ€™t reset it if itโ€™s correct (as you said). Further reading on its MDN entry explains why:

โ€œItโ€™s vital to set the message to an empty string if there are no errors. As long as the error message is not empty, the form will not pass validation and will not be submitted.โ€

Codepen has been amended. Can you please review and let me know if now correct?

1 Like

Yep, looks good now :+1: