.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Thanks for your response, I have modified validations like this,
if($("#txt_PostCouriReceivedOn").val().trim().length == 0) {
alert('Sorry, Please enter the Date of Courier Received!');
return false;
}
else
{
var frdt = $('#<%=txt_Disdate.ClientID%>').val();
var todt = $('#<%=txt_PostCouriReceivedOn.ClientID%>').val();
var firstDate = new Date(frdt.split('/')[2],frdt.split('/')[1],frdt.split('/')[0]);
var secondDate = new Date(todt.split('/')[2],todt.split('/')[1],todt.split('/')[0]);
if (firstDate <= secondDate) {
f_db.recvdt = $('#<%=txt_PostCouriReceivedOn.ClientID%>').val();
}
else{
alert('Sorry, The date of courier received should same or next day of dispatch from Branch!');
return false;
}
}
if($("#txt_DocReceivedByName").val().trim().length == 0) {
alert("Sorry! Name of the document receiver is missing!");
return false;
} else {
f_db.recvby = $('#<%=txt_DocReceivedByName.ClientID%>').val().toUpperCase();
}
if($("#txt_ReceivedPersonMobPH").val().trim().length == 0) {
alert("Sorry! Please enter the document receiver Mobile No!");
$('#txt_ReceivedPersonMobPH').focus();
$('#txt_ReceivedPersonMobPH').css('border-color', 'red');
return false;
} else {
f_db.recvph = $('#<%=txt_ReceivedPersonMobPH.ClientID%>').val();
$('#txt_ReceivedPersonMobPH').css('border-color', '');
}
Member
359 Points
526 Posts
Validators are not working when onclientclick in jquery
Oct 29, 2020 04:52 PM|ayyappan.CNN|LINK
Hi friends,
my Validators are not working, what I did wrong, check my code, and pls help me to sort out this issue.
My code
Dept of ICT.
Mark post(s) as "Answer" that helped you
All-Star
52291 Points
23326 Posts
Re: Validators are not working when onclientclick in jquery
Oct 29, 2020 05:21 PM|mgebhard|LINK
You are correct the validators do not fire when making an AJAX request. You'll need to manually validate the form.
https://www.codemag.com/Article/0307101/Validating-Data-On-Web-Forms
Contributor
3450 Points
1316 Posts
Re: Validators are not working when onclientclick in jquery
Oct 30, 2020 02:32 AM|yij sun|LINK
Hi ayyappan.CNN,
As far as I think,you could use JQuery validation.
More details,you could refer to below articles:
https://www.c-sharpcorner.com/UploadFile/ee01e6/jquery-validation-with-Asp-Net-web-form/
https://stackoverflow.com/questions/133310/how-can-i-get-jquery-to-perform-a-synchronous-rather-than-asynchronous-ajax-re
Best regards,
Yijing Sun
Member
359 Points
526 Posts
Re: Validators are not working when onclientclick in jquery
Oct 31, 2020 06:57 PM|ayyappan.CNN|LINK
Hi,
Thanks for your response, I have modified validations like this,
pls, share your views.
Dept of ICT.
Mark post(s) as "Answer" that helped you