'use strict'; const $ = jQuery; $('input, select').on('change keypress', function () { $(this).css('background-color', 'white'); }); $('textarea').on('keypress', function () { $(this).css('background-color', 'white'); }); var guardian = $('#Guardian'); var defaultGuardianText = 'தங்களது பெயர் மற்றும் மணமகன்/ மணமகள் உடன் உள்ள உறவுமுறை'; if (!guardian.val()) { guardian.val(defaultGuardianText); } guardian.on('focus', () => { if (guardian.val() === defaultGuardianText) { guardian.val(''); } }); guardian.on('blur', () => { if (!guardian.val()) { guardian.val(defaultGuardianText); } }); $(document).on('click', '#Submitbtn', function () { //$(document).on("click",".SubmitButton", function() { var MyForm = $("#MyRegister"), MyName = $("#MyName"), MyStatus = $("#MyStatus"), MyStatCkd = $(".MyStatus:checked"), MyMobile = $("#Mobile"), MyAge = $("#MyAge"), MyQualify = $("#MyQualify"), MyMarrital = $("#MyMarrital"), MyNative = $("#MyNative"), MyLanguage = $("#MyLanguage"), MyJob = $("#MyJob"), MyIncome = $("#MyIncome"), MyHeight = $("#MyHeight"), MyProp = $("#MyProp"), MyPhoto = $("#MyPhoto"), MyPhoto1 = $("#MyPhoto1"), MyPhoto2 = $("#MyPhoto2"), MyPhoto3 = $("#MyPhoto3"), MyDetails = $("#MyDetails"), Guardian = $("#Guardian"), Password = $("#Password"), MyHidden = $("#hidden"), SendMVCode = $("#SendMVCode"), SendMVMobile = $("#SendMVMobile"), Submit = $("#Submit"), ReSubmit = $("#ReSubmit"), ShowMobile = $("#ShowMobile"), Verify = $("#Verify"), VerifyOver = $("#VerifyOver"), MVCode = $("#MVCode"), CVCode = $("#CVCode"); if (MyStatCkd.length === 0) { alert("தயவுசெய்து உங்கள் பாலினத்தை தேர்வு செய்யவும்."); MyStatus.focus(); return false; } if (!MyName.val()) { alert('தயவுசெய்து உங்கள் பெயரை பதிவு செய்யவும்.'); MyName.css('background-color', 'lightyellow').focus(); return false; } var Mobiles = MyMobile.val(); //var arrmobile = Mobiles.split(","); var arrmobile = Mobiles.split(/[\s,.]+/); //seperated by comma or space or dot and also can add extra sympols var breakOut = true; //arrmobile.forEach(function(index, value) { this is number of array times alerting; $.each(arrmobile, function (key, value) { var MobileVal = value.replace(/\s/g, ""); var char = MobileVal.charAt(0);//alert(char); if ((char === "0" || char === "1" || char === "2" || char === "3" || char === "4" || char === "5") || (isNaN(MobileVal) || (MobileVal.length < "10") || (MobileVal.length > "10"))) { alert("தயவுசெய்து " + MobileVal + " எண்களை சரிபார்த்து, 10 இலக்க தொலைபேசி எண்களை பதியவும். 6, 7, 8 (அ) 9 ஆகிய எண்களில் ஆரம்பிக்கவேண்டும்."); MyMobile.css("background-color", "lightyellow"); MyMobile.focus(); breakOut = false; return false; } }); if (breakOut === false) { return false; } if (MyAge.val() === "" || MyAge.val() === undefined) { alert("தயவுசெய்து உங்கள் வயதை தேர்வு செய்யவும்."); MyAge.css("background-color", "lightyellow"); MyAge.focus(); return (false); } if (MyQualify.val() === "" || MyQualify.val() === undefined) { alert("தயவுசெய்து உங்கள் படிப்பை பதிவு செய்யவும்."); MyQualify.css("background-color", "lightyellow"); MyQualify.focus(); return (false); } if (MyMarrital.val() === "" || MyMarrital.val() === undefined) { alert("தயவுசெய்து நீங்கள் திருமணம் ஆனவரா, இல்லையா என்பதை தேர்வு செய்யவும்."); MyMarrital.css("background-color", "lightyellow"); MyMarrital.focus(); return (false); } if (MyNative.val() === "" || MyNative.val() === undefined) { alert("தயவுசெய்து வசிப்பிடத்தை பதிவு செய்யவும்."); MyNative.css("background-color", "lightyellow"); MyNative.focus(); return (false); } if (MyLanguage.val() === "" || MyLanguage.val() === undefined) { alert("தயவுசெய்து உங்கள் மொழியை தேர்வு செய்யவும்."); MyLanguage.css("background-color", "lightyellow"); MyLanguage.focus(); return (false); } if (MyJob.val() === "" || MyJob.val() === undefined) { alert("தயவுசெய்து நீங்கள் என்ன வேலை செய்கிறீர் என்பதை பதிவு செய்யவும். வேலை இல்லை என்றால் 'இல்லை' என்று குறிப்பிடவும். "); MyJob.css("background-color", "lightyellow"); MyJob.focus(); return (false); } var MyIncomeVal = $.trim(MyIncome.val()); if (!$.isNumeric(MyIncomeVal)) { alert("தயவுசெய்து எண்களை மட்டும் உபயோகித்து மாத வருமானத்தை பதிவு செய்யவும். வருமானம் இல்லை என்றால் '0' என குறிப்பிடவும்."); MyIncome.css("background-color", "lightyellow"); MyIncome.focus(); return (false); } if (MyHeight.val() === "" || MyHeight.val() === undefined) { alert("தயவுசெய்து உங்கள் உயரத்தை பதிவு செய்யவும்."); MyHeight.css("background-color", "lightyellow"); MyHeight.focus(); return (false); } if (MyProp.val() === "" || MyProp.val() === undefined) { alert("தயவுசெய்து உங்கள் சொத்தை பதிவு செய்யவும். சொத்து இல்லை என்றால் 'இல்லை' என குறிப்பிடவும்."); MyProp.css("background-color", "lightyellow"); MyProp.focus(); return (false); } if (MyPhoto.val() === "" && MyPhoto1.val() === "" && MyPhoto2.val() === "" && MyPhoto3.val() === "") { if(MyStatCkd.val() != "மணமகள்"){ alert("தயவுசெய்து! தங்களது ஒர் புகைப்படத்தை தேர்வு செய்யவும்."); MyPhoto1.css("background-color", "lightyellow"); MyPhoto1.focus(); return (false); } } if (MyDetails.val() === "" || MyDetails.val() === undefined) { alert("தயவுசெய்து உங்களை பற்றி சற்று விளக்கமாக பதிவு செய்யவும்."); MyDetails.css("background-color", "lightyellow"); MyDetails.focus(); return false; } if (Guardian.val() === "" || Guardian.val() === "தொடர்பு கொள்ள வேண்டிய நபரின் பெயர் மற்றும் உறவுமுறை") { alert("தயவுசெய்து தொடர்புகொள்ள வேண்டிய நபரின் பெயர் மற்றும் உறவுமுறையை பதிவு செய்யவும்"); Guardian.css("background-color", "lightyellow"); Guardian.focus(); return false; } if (Password.val().length < 4 || Password.val().length > 6) { alert("தயவுசெய்து நினைவிற்கொள்ளும் Password-ஐ 4 முதல் 6 இலக்கங்களுக்குள் பதிவு செய்யவும்."); Password.css("background-color", "lightyellow"); Password.focus(); return (false); } if (MyMarrital.val() === "" || MyMarrital.val() === undefined) { alert("தயவுசெய்து நீங்கள் திருமணம் ஆனவரா, இல்லையா என்பதை தேர்வு செய்யவும்."); MyMarrital.css("background-color", "lightyellow"); MyMarrital.focus(); return (false); } if (MyNative.val() === "" || MyNative.val() === undefined) { alert("தயவுசெய்து வசிப்பிடத்தை பதிவு செய்யவும்."); MyNative.css("background-color", "lightyellow"); MyNative.focus(); return (false); } if (MyLanguage.val() === "" || MyLanguage.val() === undefined) { alert("தயவுசெய்து உங்கள் மொழியை தேர்வு செய்யவும்."); MyLanguage.css("background-color", "lightyellow"); MyLanguage.focus(); return (false); } if (MyJob.val() === "" || MyJob.val() === undefined) { alert("தயவுசெய்து நீங்கள் என்ன வேலை செய்கிறீர் என்பதை பதிவு செய்யவும். வேலை இல்லை என்றால் 'இல்லை' என்று குறிப்பிடவும். "); MyJob.css("background-color", "lightyellow"); MyJob.focus(); return (false); } var MyIncomeVal = $.trim(MyIncome.val()); if (!$.isNumeric(MyIncomeVal)) { alert("தயவுசெய்து எண்களை மட்டும் உபயோகித்து மாத வருமானத்தை பதிவு செய்யவும். வருமானம் இல்லை என்றால் '0' என குறிப்பிடவும்."); MyIncome.css("background-color", "lightyellow"); MyIncome.focus(); return (false); } if (MyHeight.val() === "" || MyHeight.val() === undefined) { alert("தயவுசெய்து உங்கள் உயரத்தை பதிவு செய்யவும்."); MyHeight.css("background-color", "lightyellow"); MyHeight.focus(); return (false); } if (MyProp.val() === "" || MyProp.val() === undefined) { alert("தயவுசெய்து உங்கள் சொத்தை பதிவு செய்யவும். சொத்து இல்லை என்றால் 'இல்லை' என குறிப்பிடவும்."); MyProp.css("background-color", "lightyellow"); MyProp.focus(); return (false); } if (MyPhoto.val() === "" && MyPhoto1.val() === "" && MyPhoto2.val() === "" && MyPhoto3.val() === "") { if(MyStatCkd.val() != "மணமகள்"){ alert("தயவுசெய்து தங்களது ஒர் புகைப்படத்தை தேர்வு செய்யவும்."); MyPhoto1.css("background-color", "lightyellow"); MyPhoto1.focus(); return (false); } } if (MyDetails.val() === "" || MyDetails.val() === undefined) { alert("தயவுசெய்து உங்களை பற்றி சற்று விளக்கமாக பதிவு செய்யவும்."); MyDetails.css("background-color", "lightyellow"); MyDetails.focus(); return false; } if (Guardian.val() === "" || Guardian.val() === "தொடர்பு கொள்ள வேண்டிய நபரின் பெயர் மற்றும் உறவுமுறை") { alert("தயவுசெய்து தொடர்புகொள்ள வேண்டிய நபரின் பெயர் மற்றும் உறவுமுறையை பதிவு செய்யவும்"); Guardian.css("background-color", "lightyellow"); Guardian.focus(); return false; } if (Password.val().length < 4 || Password.val().length > 6) { alert("தயவுசெய்து நினைவிற்கொள்ளும் Password-ஐ 4 முதல் 6 இலக்கங்களுக்குள் பதிவு செய்யவும்."); Password.css("background-color", "lightyellow"); Password.focus(); return (false); } var MVCodeVal = MVCode.val();//alert(MVCodeVal); var Mobiles = MyMobile.val(); var Arrmobile = Mobiles.split(/[\s,.]+/); //seperated by comma or space or dot and also can add extra sympols // Mobiles = Mobiles.replace(/\s/g, ""); // var Arrmobile = Mobiles.split(","); var Mobile = Arrmobile[0];//alert(Mobile); var MyNameVal = MyName.val(); var MyGenderVal = MyStatCkd.val(); //var MyGuardianVal = Guardian.val(); //if($("#SubmitButton").context.activeElement.value == "Submit"){ var count1 = 0; if ($(this).val() == "Submit"){ count1++; if(count1 === 1){ $.ajax({ url: "Ajax/SendMVCode.php", cache: false, method: "POST", // Either get or post data: {AllMobiles: Mobiles, SendMobile: Mobile, SendCode: MVCodeVal, Name: MyNameVal, Gender: MyGenderVal} }).done(function (response) { //alert(response); var splitted = response.split("|"); SendMVCode.html(splitted[0]); SendMVMobile.html(splitted[1]); Submit.html(""); ReSubmit.html(splitted[2]); ShowMobile.html(splitted[3]); if (splitted[3] === "" || splitted[3] === undefined){ Verify.hide(); } }); alert("தங்களின் " + Mobile + " தொலைபேசிக்கு verification code அனுப்பப்படும். அதனை இங்கே பதிவு செய்யவும்."); Verify.show(); return (false); } } var count2 = 0; if ($(this).val() == "ReSubmit"){ count2++; if(count2 === 1){ var Mobiles = MyMobile.val(); var Arrmobile = Mobiles.split(/[\s,.]+/); //seperated by comma or space or dot and also can add extra sympols //Mobiles = Mobiles.replace(/\s/g, ""); //var Arrmobile = Mobiles.split(","); var Mobile = Arrmobile[0];//alert(Mobile); var MyNameVal = MyName.val(); var MyGenderVal = MyStatCkd.val(); //var MyGuardianVal = Guardian.val(); var MVCodeVal = MVCode.val();//alert(Code); $.ajax({ url: "Ajax/SendMVCode.php", cache: false, method: "POST", // Either get or post data: {AllMobiles: Mobiles, SendMobile: Mobile, SendCode: MVCodeVal, Name: MyNameVal, Gender: MyGenderVal} }).done(function (response) { var splitted = response.split("|"); // RESULT SendMVCode.html(splitted[0]); // The first name SendMVMobile.html(splitted[1]); // The secondname Submit.html(""); ReSubmit.html(""); ShowMobile.html(splitted[3]); if (splitted[3] === "" || splitted[3] === undefined){ Verify.hide(); } }); alert("தங்களின் " + Mobile + " தொலைபேசிக்கு verification code அனுப்பப்படும். அதனை இங்கே பதிவு செய்யவும்."); Verify.show(); return (false); } } if ($(this).val() == "Verify") { if (CVCode.val() === "" || CVCode.val() === undefined) { alert("தயவுசெய்து verification code-ஐ இன்கே பதிவு செய்யவும்."); CVCode.focus(); return (false); } if (CVCode.val().length > 0) { var CVCodeVal = CVCode.val().toLowerCase(); var MVCodeVal = MVCode.val().toLowerCase(); var count3 = 0; if (MVCodeVal === CVCodeVal) { count3++; if(count3 === 1){ Verify.hide(); VerifyOver.show(); MyForm.submit(); return (true); } else { return false; } } else { alert("தயவுசெய்து சரியான verification code-ஐ பதிவு செய்யவும்."); CVCode.focus(); return (false); } return (false); } return (false); } return (false); }); /*this is for prevent multiple submission of the form*/ /*https://www.toddlahman.com/prevent-duplicate-form-submissions-with-jquery/*/ jQuery('form').submit(function(){ $(this).find(':submit').attr( 'disabled','disabled' ); }); /*end*/ $(function () { "use strict"; $(".Input-Box").hover( function () { $(this).next().show(); }, function () { $(this).next().hide(); } ); });