Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using mutiple patterns in <input> html 5 form for validation

I have requirement for my input in the form... my valid values are number or "No Min" or "No Max". now I can use pattern for string value or number but not both... my question is how can i use multiple pattern in html 5 input tag... I am also using jQuery...

 <form id="form_searchProperty"  >
  <div class="criteria_block">
   <span><label class="search_form_Label" for="propbath">Bathroom</label></span>
     <span>
          <input id="input_propbath_min" value="No Min" pattern ="\d+" name="Min_Bathrooms" style="width:75px;"/>
          <input id="input_propbath_max" value="No Max" pattern ="\d+" name="Max_Bathrooms" style="width:75px;" />
      </span>
    </div>
  </form>
like image 922
K.Z Avatar asked Feb 12 '26 12:02

K.Z


1 Answers

You can use the OR (|) operator.

pattern="(No M(in|ax))|\d+"
like image 79
Alyssa Ross Avatar answered Feb 16 '26 04:02

Alyssa Ross



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!