Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove "Please match the requested format"

How do I change "Please match the required format" with "Not valid"

I've Looked all over the Stackoverflow couldn't find anything that help it may be a duplicate but please help me!

If I type 'asd' in the field, then press GO, and then continue to type the message "Please match the required format" will appear

I don't want messy code, I want it to be in the html tags if possible!

<form id="banner-message">
    <input value=""
    name="email" 
    id="inputEmail"
    class="form-control"
    placeholder="email"
    required="" 
    autofocus=""  
    oninvalid="this.setCustomValidity('Not Valid')"                                               oninput="setCustomValidity('')"
    pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$">

    <button class="btn btn-lg  btn-block" type="submit">Go</button>
</form>
like image 236
ThunderHorn Avatar asked Aug 20 '18 14:08

ThunderHorn


People also ask

What does Please match the format requested mean?

ago. Additional comment actions. This is caused by a hidden input that appears to be for a one-time password. It's got no value but it has a pattern attribute indicating that it has to contain a number, so browsers that do pattern validation on input fields, like Chrome and Firefox, won't submit the form.


2 Answers

You need to use onchange and this.setCustomValidity

  <form id="banner-message">
      <input value="" 
      name="email" 
      id="inputEmail"
      class="form-control"
      placeholder="email"
      required=""
      autofocus="" 
      oninvalid="this.setCustomValidity('Not Valid')"
      onchange="try{setCustomValidity('')}catch(e){}"
      oninput="setCustomValidity(' ')"
      pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$">

      <button class="btn btn-lg  btn-block" type="submit">Go</button>
    </form>
like image 96
Hyyan Abo Fakher Avatar answered Sep 22 '22 06:09

Hyyan Abo Fakher


<form id="banner-message">
    <input value=""
    name="email" 
    id="inputEmail"
    class="form-control"
    placeholder="email"
    required="" 
    autofocus=""  
    oninvalid="this.setCustomValidity('Not Valid')"                                               oninput="setCustomValidity('')"
    pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$">

    <button class="btn btn-lg  btn-block" type="submit">Go</button>
</form>
like image 29
Prince kumar pandit Avatar answered Sep 23 '22 06:09

Prince kumar pandit