Can I get the ASP.NET RangeValidator an onblur/onfocus events to play nice with each other?

I have a textbox for entering a currency amount, with a RangeValidator control making sure the value entered is between 1 and 99999999.99. The field also has an “onblur” event that fires off some JavaScript to format the input with commas and a decimal point (e.g. 12455 -> 12,455.00). There's also a "onfocus" event that reverses the "onblur" effect, putting the value back into an editable format (e.g. 12,455.00 -> 12455.00. My problem is the RangeValidator doesn't like the formatted value with the commas and subsequently fails on the validation. Is there a way to get around that? I want to be able to range check the value, yet still present it formatted when the textbox doesn't have focus. I realize that a CustomValidator could probably work, but I was hoping to get this to work with the RangeValidator.

以上就是Can I get the ASP.NET RangeValidator an onblur/onfocus events to play nice with each other?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏