Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
And that's why we could an html5 nput element defined by a regex and/or a validate function.
-
Depends on the context? Is it likely they will enter exponent numbers? What happens when I would just enter 'e'
-
xewl41267yWhen you expect an integer value, force it to be one and do not allow exponents. Also, do not trust solely on type="number". It's only a first layer provided by the browser, I reckon you have at least a server side validation, and maybe a javascript based one.
LSS: If you don't expect exponents, don't allow them either, indefinitely. -
Actually, e is "Euler's number" which is a mathematical constant and roughly equals 2,718281828459045
https://en.m.wikipedia.org/wiki/... -
nightowl6987yTo be fair it might not be obvious to those who are unfamiliar with what an exponent is. I mean, I used to see "e" in a number on a calculator screen and assume it meant "error" because it couldn't fit the whole number on the screen. I could use a computer and phone, I was familiar with web development and programming, but I wasn't that great at maths. I know what an exponent is *now*, but it might be alien to a lot of people.
Its annoying to have to parse a string manually to check for decimals and THEN convert it to an integer though. Do wish there was a way to just do "simple" numeric input. -
IMHO,
I think it depends on what specification says... If it is an input for person id, then there should not be any letters at all. To be short it should be specified, is it *numeric* or *number*.
What UX teached me, is that every user is dumb af and you should remove any confusing elements to prevent bugs and missunderstandings. -
Id be pissed if my calculator didnt support e, although, imo it should be E not e, e should refer to eulers number
-
I understand... But you gotta cater for literally everyone, mathematically inclined or those who simply can't type and might have meant to your '3', not 'e'.
Sucks, I know...
Our html:
<input type="number"/>
Accepts only numbers, so far so good. Until QA files a bug:
"Numeric input accepts the letter 'e' "
Apparently 'e' is a valid because you can input something like '1e3' which fucking means '1000' !
Our team tried to argue with the QA that 'e' is valid because it simply means exponent but they argue a normal user would not know what an exponent means because they are not "mathematically inclined"
Part of me agrees with what the QA argues but then I think an average user who could use a fucking laptop or mobile will most certainly know what an exponent is.
rant
exponent
input number