ASP.net MVC中文本框的客户端验证 [英] Client Validation for Textbox in ASP.net MVC

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

问题描述

目标:

*当您按下提交按钮时,应在文本框内执行客户端验证。



*如果是okey ,去行动结果。

否则,用OK按钮显示带有最多10个字母的弹出消息。



标准是最多10个字母。



问题:

我不知道如何处理ASP.net MVC的源代码。



信息:

*我正在使用VS2013和ASP.net mvc,jQuery,javascript

*没有服务器验证!

*代码适用于许多网页浏览器会很棒。







查看



 @ using(Html.BeginForm( 创建 测试,FormMethod.Post)
{
< input type = text value = />

< input type = submit value = 搜索 />

@ Html.AntiForgeryToken()
}

解决方案

请参考下文。



http://weblogs.asp.net/scottgu/asp-net-mvc-2-model-validation [ ^ ]



< a href =http://www.codeproject.com/Articles/275056/Custom-Client-Side-Validation-in-ASP-NET-MVC> ASP.NET MVC3中的自定义客户端验证 [< a href =http://www.codeproject.com/Articles/275056/Custom-Client-Side-Validation-in-ASP-NET-MVC\"target =_ blanktitle =New Window> ^ ]



http://www.dotnet-tricks.com/Tutorial/mvc/D8I4270712-MVC-Data-Annotations-for-Model-Validation.html [ ^ ]

检查这个...

 


#button)。click( function (){
if


Goal:
*When you press the submit button a client validation should be executed inside of a textbox.

*If okey, go the the actionresult.
Otherwise, show a popup message with statement "max 10 letter" with a OK button.

The criteria is that max 10 letters.

Problem:
I don't know how to do it in relation to ASP.net MVC's sourcecode.

Info:
*I'm using VS2013 with ASP.net mvc, jQuery, javascript
*No server validation!!!
*It would be great that the code can be working for many web browser.



View

@using (Html.BeginForm("Create", "Test", FormMethod.Post)
{
<input type="text" value="" />

<input type="submit" value="Search" />

@Html.AntiForgeryToken()
}

解决方案

Please refer below.

http://weblogs.asp.net/scottgu/asp-net-mvc-2-model-validation[^]

Custom Client Side Validation in ASP.NET MVC3[^]

http://www.dotnet-tricks.com/Tutorial/mvc/D8I4270712-MVC-Data-Annotations-for-Model-Validation.html[^]


check this...


("#button").click(function() { if(


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

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