验证文本框多行 [英] validating the textbox multi line

查看:110
本文介绍了验证文本框多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个启用了多行的文本框。我希望它只接受350个字符,所以我使用了max length属性,它也抛出了我的错误信息,但问题是它接受了超过350.我是java脚本的新手,所以帮助我使用脚本。

I have a textbox with multiline enabled . I want it to accept only 350 characters so i used max length property and it throws me error message too, but the prob is its accepting more than 350.I am new to java script so help me with scripts.

推荐答案

这是使用javascript的简单解决方案。它还验证复制/粘贴/的数据长度。



http://developer.sheikhharis.com/2010/06/max-length-not-working-for-multi-line.html [ ^ ]
Here is the simple solution using javascript. it also validate data length in case of Copy/Paste/.

http://developer.sheikhharis.com/2010/06/max-length-not-working-for-multi-line.html[^]


干得好。使用以下RegularExpression ^ [\\\\ S] {0,350}
Here you go. Use the following RegularExpression ^[\s\S]{0,350}


使用Asp.net的RegularExpressionValidator控件。 />


--Amit
with RegularExpressionValidator control of Asp.net.

--Amit


这篇关于验证文本框多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆