lundi 15 octobre 2018

HTML5 Pattern for FULLNAME

Im trying to validating a form submit just if in just ONE field, the user enter his First Name and Last Name.

I know: in other countries are not like this, but im doing for Brazil, so its First Name and Last Name.

What im tryed and achiev:

<input type="text" name="fullname" pattern="^.* .*$">

But dont worked.

The fild needs a First name (minimum 2 characters, no limit), a SPACE, then the last nme with minimum 1 characters and no limit too.

Examples:

TRUE:

João da Silva

João S

João S.

Joao S. Pedro

FALSE:

Joao

João

Joao (just a space)

I hope u can understand me.

Thank you so much.

Aucun commentaire:

Enregistrer un commentaire