jeudi 27 octobre 2016

Allow 10 or 20 characters in a form input

In a form input, where the user fills a sequence of characters (from a barcode scanner), I want to apply a form control where the input can accept only 10 or 20 length sequence of characters.

If I wanted just one of them, lets say 10 I could use:

<input type="text" pattern=".{10,10}" name="barcode" />

Is there a way to enable the above control? I tried

<input type="text" pattern=".{10,10}+.{20,20}" name="barcode" /> 

but it didn't work..

Aucun commentaire:

Enregistrer un commentaire