如何在日历控件texbox上的jquery中进行验证 [英] How to do validation in jquery on calendar control texboxes

查看:95
本文介绍了如何在日历控件texbox上的jquery中进行验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要在Jquery上用弹出消息验证startfrom date和Enddate Calendar控件,重点是填充两个texbox



我尝试过:



Hi,
I need to validate startfrom date and Enddate Calendar control with a popup message in Jquery on focusout anfer filling both the texboxes

What I have tried:

<pre>$(document).ready(function () {
            $("#txtFromDate.ClientID").focusin(function () {
               
            });
        var obj = {};
        obj.date3 = $.trim($("[id*=txtFromDate]").val());
        obj.date4 = $.trim($("[id*=txtToDate]").val());
        if (obj.date3 != "" && obj.date4 != "") {

            $.ajax({
                type: "POST",
                url: 'LMSEmployee.aspx/GetCurrentTime',
                data: JSON.stringify(obj),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (message) {
                    if (message == "") {
                        alert("Not allowed to take leave");
                    }
                    else {
                        alert("");
                    }
                }
            });
        }
            else
            return false;
       
        });




<pre><asp:TextBox ID="txtFromDate" runat="Server" placeholder="Select From Date" CssClass="lmsFieldValue"

                        OnTextChanged="txtFromDate_TextChanged"></asp:TextBox>
                    <asp:CalendarExtender ID="CalendarExtender1" CssClass="calendercssclass" runat="server"

                        TargetControlID="txtFromDate" Format="MM/dd/yyyy" OnClientDateSelectionChanged="ValidateDate">
                    </asp:CalendarExtender>


<asp:TextBox ID="txtToDate" runat="Server" placeholder="Select To Date" CssClass="lmsFieldValue"></asp:TextBox>
                    <asp:CalendarExtender ID="CalendarExtender2" CssClass="calendercssclass" runat="server"

                        TargetControlID="txtToDate" Format="MM/dd/yyyy" OnClientDateSelectionChanged="ValidateDate">
                    </asp:CalendarExtender>

推荐答案

document )。ready( function (){
(document).ready(function () {


#txtFromDate.ClientID)。focusin( function (){

});
var obj = {};
obj.date3 =
("#txtFromDate.ClientID").focusin(function () { }); var obj = {}; obj.date3 =


.trim(


这篇关于如何在日历控件texbox上的jquery中进行验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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