When hinting at the format for strict data entry in a textbox on a website (<input type="text"/>), I normally use A to represent alphabetic characters, and 9 for numeric characters.

Therefore AA999 would signify that things like AB123 or xy221 would be accepted.

But is there a standard way to state that you can enter an alphanumeric character (i.e. [a-zA-Z0-9] in regex)?

  • 1
    Do you have a more concrete example to share that we could base ourselves on? – Tim FitzGerald Aug 28 '14 at 15:25
  • Is there any restrictions at all on the data in the textbox? Min/max length? Any types of character disallowed? – Vince Bowdren Aug 28 '14 at 15:26
  • Also, is there a use case for this input? UK Royal Mail's postcodes have a complex rule set, sometimes alpha, sometimes numeric, sometimes eitehr. Their lookup tool provides realtime feedback as you type, without giving the user specific instructions to follow. – Tim FitzGerald Aug 28 '14 at 15:31
  • @TimFitzGerald, sorry, but I'm not sure what examples I can give you. I'm simply asking if there is a way to easily convey the fact that an input has a particular format, and a particular character can either be a letter or a number. I'm obviously not asking this correctly, because it's not a difficult concept in my mind! – freefaller Aug 28 '14 at 17:21

Could you use a place holder attribute to say "e.g. 9876 5432 1098 7654"

I generally find it's better to use a realistic example rather than a symbolic one. It's more quickly understood.

For a british license plate "e.g. AB01 CDE" is more quickly understood than "XX## XXX".


I wouldn't say there is a standard way, Another way you can do it is a validation system like they do for passwords.

  • 1
    It not so much a validation thing, but a way of telling the user the correct format of the information that requires entering before they submit the form. I normally do this by putting static text next to the input such as [dd/mm/yyyy] for dates, or [AA999] for specific. it's just how to easily tell them that a character can be either A or 9 that I'm struggling with – freefaller Aug 28 '14 at 13:59
  • @freefaller oh well then you can just give examples – Hertz Aug 28 '14 at 17:55

If a textfield accepts any character, then the best way to indicate this is to put nothing at all by the textfield. That's the default, normal state for textfields: accepting any text (it's called free text for a reason). Any special hints will just end up being distracting and confusing more than it will help the user.

  • I don't think that's what the OP was asking for. His request was about setting expectation for a strict format field. – Pdxd Aug 29 '14 at 17:12
  • I'm not sure it's what the OP was asking for either; but I'm not sure it's not what the OP was asking for. I'm hoping they clarify, so we can be sure what kind of answer would be useful. – Vince Bowdren Sep 1 '14 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.