0

How can I customize the 2 warning text in 1 Input Field.

The 1 is for required/invalid and The 1 is for pattern (2 attributes for validation).

I try to do it, Somebody, Please Help Me, Correct the Code, The Codepen link is on the comment section.


I search this including on the stackoverflow but I can't find any solution for this answer.

Cuz' The only thing they asked & already answered was the 1 warning txt customization only.

Like this one: changing the language of error message in required field in html5 contact form

& this one: How to change warning text when pattern is used in input?


I'm beginner in js, I only know some basics & I'm trying to find some clues on how can I do it, But i can't find any answer. Thankyou so much in advance for your help.


Unknown
  • 13
  • 4
  • Look at the JSFiddle link in the accepted answer to https://stackoverflow.com/questions/10753881/changing-the-language-of-error-message-in-required-field-in-html5-contact-form -- Where it tests `if (!textfield.validity.valid)`, instead test for `if (textfield.validity.valueMissing)` and set a message to indicate the field is required, `elseif (textfield.validity.patternMismatch)` and set a message to indicate a pattern failure. – Niet the Dark Absol Jul 24 '21 at 11:34
  • You can look at bootstrap validation from here https://www.w3schools.com/bootstrap4/bootstrap_forms.asp – Gamer In The Game Jul 24 '21 at 11:41
  • Sorry, I'm beginner in js I only know some basics, How to do it, this is what i do: https://codepen.io/supreme-07/pen/yLbPRdy Original Fiddle that you said: http://jsfiddle.net/zpkKv/2/ – Unknown Jul 24 '21 at 12:04

0 Answers0