jQuery的互动线索错误状态风格 [英] jQuery Interaction Cues for Error State Style

查看:191
本文介绍了jQuery的互动线索错误状态风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用jQuery的CSS框架样式的必填字段错误。当表单提交的文本框中没有价值,应该prevent形式的提交,并应显示与下面的风格。

•UI辅助复位

•UI辅助-clearfix

•UI态错误文本

•UI图标警戒

什么是做到这一点的最好方法是什么?

注:code对应于ASP.NET(的形式=服务器

在code:

 < HTML LANG =EN>

< HEAD>

<脚本类型=文/ JavaScript的SRC =htt​​p://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.js>< / SCRIPT>
<脚本类型=文/ JavaScript的SRC =htt​​p://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.6/jquery-ui.js>< / SCRIPT>
<链接HREF =htt​​p://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.13/themes/flick/jquery-ui.css
    相对=样式类型=文本/ CSS/>
<冠军>互动线索< /标题>
< /头>

<身体GT;
    <% -  UI辅助复位,UI辅助-clearfix,UI状态错误文本,UI图标警戒 - %>
    <形式=服务器>

        < D​​IV>
            &其中a取代;用户名< / A>
            <输入ID =文本1型=文本/>
            <跨度> *< / SPAN>
            < A>必填字段< / A>
        < / DIV>

    <输入ID =Button1的类型=按钮值=按钮/>
    < /形式GT;
< /身体GT;

< / HTML>
 

解决方案
  • 的onclick添加事件上的按钮,
  • 在功能的onclick把所有你想要的验证
  • 如果成功__d​​oPostBack('','');
  • 如果没有显示信息或某事

I am trying to use jQuery CSS Framework for styling the required field error. When the form is submitted with no value in the text box, it should prevent the form from submitting and should display the style corresponding to the following.

• ui-helper-reset

• ui-helper-clearfix

• ui-state-error-text

• ui-icon-alert

What is the best way to do this?

Note: The code is corresponding to ASP.NET (form runat="server")

The CODE:

<html lang="en">

<head>

<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.6/jquery-ui.js"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.13/themes/flick/jquery-ui.css"
    rel="stylesheet" type="text/css" />
<title>Interaction cues</title>
</head>

<body>
    <%-- ui-helper-reset, ui-helper-clearfix, ui-state-error-text,  ui-icon-alert--%>
    <form runat="server" >

        <div> 
            <a> User Name </a>
            <input id="Text1" type="text" />
            <span> * </span>
            <a>Required field</a> 
        </div>

    <input id="Button1" type="button" value="button" />
    </form>
</body>

</html>

解决方案

  • add the event onclick on the button,
  • on the function onclick put all the validation you want
  • if success __doPostBack('','');
  • if failed display message or something

这篇关于jQuery的互动线索错误状态风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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