Reputation: 977
I'm validating a HTML textbox field<input type="text" />
, and I need to detect if the user has entered a Macron in the textbox. My question is that is there any way to TYPE (Not copy-paste) a Macron into an HTML textbox??
If so, how would you detect if the user has typed a Macron?
I've checked this page. At the bottom, it's shown how to type it, but I couldn't.
Upvotes: 0
Views: 1127
Reputation: 201748
Yes, you should always assume that users can type any character in a textbox. This is true no matter what you mean by “macron” here. It could mean U+00AF MACRON “¯”, or U+0304 COMBINING MACRON, or macron as part of a character as in U+0101 LATIN SMALL LETTER A WITH MACRON “ā”.
For example, using a normal Finnish keyboard with a keyboard driver that conforms to the modern Finnish standard, I typed “¯” using just AltGr ¨ space and “ā” using AltGr ¨ A. Entering the combining macron is possible using e.g. my own keyboard driver for combining marks or the “universal method” described on the Fileformat.info page How to enter Unicode characters in Microsoft Windows.
You can detect a macron, in any meaning, by inspecting the value of the field. When using JavaScript, you can e.g. check whether the value contains \u00af
(if you are not sure how to enter “¯” directly into your code and ensure that it is reas properly).
Upvotes: 0
Reputation: 1514
Yes it is possible with Alt Codes
Alt-0175 Gives a macron ¯ in a input field.
However, i dont know how to combite the macron with a character, but that wasn't the question.
EDIT : found these ALT codes for macron characters. (only work in Word)
Lowercase Vowels
Capital Vowels
Upvotes: 1