Monday, 10 August 2015

server site validation shown in client site in MVC

$("#btnCreateAccount").click(function (e) {

//alert('btnCreateAccount cliked..');

//var mm = $("form");





if ($("form").valid())



{

e.preventDefault();

var sdate = $('#StartDate').val().split('/');

var sday = sdate[1];

var smon = sdate[0];

var syear = sdate[2];

var edate = $('#EndDate').val().split('/');

var eday = edate[1];

var emon = edate[0];

var eyear = edate[2];

var scdate = new Date(syear, smon, sday);

var ecdate = new Date(eyear, emon, eday);

if (ecdate < scdate) {

$('#EEnddate').css("color", "red");

$('#EEnddate').text('You can not select end date as past date.')

return;



}

var kendoWindow = $("<div />").kendoWindow({

title: "Confirm",

resizable: false,

modal: true



});

kendoWindow.data("kendoWindow")

.content($("#save-confirmation").html())



.center().open();

kendoWindow

.find(".save-confirm,.save-cancel")

.click(function () {

if ($(this).hasClass("save-confirm")) {







$("form").submit();



}

kendoWindow.data("kendoWindow").close();



})

.end()

}

});


No comments:

Post a Comment