问题很简单: 我的表格有文字箱,在其中一个文本箱中,我想用户要进入一个正面或负面的2-数字号。 我期望以简单的方式执行这一限制,即不必压缩数量并检查其绝对价值是否低于100。
If I set the textbox maxlength to 2, they cannot enter numbers below -9. If the maxlength is 3, they can enter numbers above 99.
A masked textbox has no solution, I cannot make the "-" literal optional, or at least not that I know of.
What would be the simplest solution to this restriction: "An empty textbox will accept 2 input characters if no "-" is typed, otherwise it accepts 3"? Handling the change event to see if a "-" was typed and resetting maxlength seems a bit overkill...