toastr.clear(); toastr.options = { closeButton: true, debug: false, newestOnTop: true, progressBar: false, positionClass: "toast-bottom-center", preventDuplicates: true, showDuration: "1000", hideDuration: "10000", timeOut: "2000", extendedTimeOut: "1000", }; $(document).ready(function () { $("#st_regform").submit(function () { var error = ""; $("#st_regform button[type='submit']").html( 'Please wait' ); $("#st_regform button[type='submit']").attr("disabled", "true"); $.ajax({ url: "https://wbchseapp.wb.gov.in/portal/register-action", type: "POST", dataType: "json", data: new FormData($("#st_regform")[0]), async: true, contentType: false, cache: false, processData: false, success: function (data) { toast_type = data.type; $("#st_regform button[type='submit']").html( 'Create Account' ); $("button[type='submit']").removeAttr("disabled"); if (data.type == "success") { // window.location = "otp-verification"; window.location = "dashboard_student"; } if (toast_type == "success") { // toastr.success(''+data.text); toastr.success( '' + data.text ); $(".signup_errmsg").html( '
Alert!
' + data.text + "
" ); } else { toastr.warning( '' + data.text ); } }, error: function (xhr, ajaxOptions, thrownError) { toastr.error( ' Failed! Something is wrong.' ); $("#st_regform button[type='submit']").html( 'Create Account' ); $("#st_regform button[type='submit']").removeAttr("disabled"); }, }); return false; }); // $("#st_regform_test_mail").submit(function () { var error = ""; $("#st_regform_test_mail button[type='submit']").html( 'Please wait' ); $("#st_regform_test_mail button[type='submit']").attr("disabled", "true"); $.ajax({ url: "https://wbchseapp.wb.gov.in/portal/register-action-test-mail", type: "POST", dataType: "json", data: new FormData($("#st_regform_test_mail")[0]), async: true, contentType: false, cache: false, processData: false, success: function (data) { toast_type = data.type; $("#st_regform_test_mail button[type='submit']").html( 'Create Account' ); $("button[type='submit']").removeAttr("disabled"); if (data.type == "success") { // window.location = "otp-verification"; // window.location='dashboard_student'; } if (toast_type == "success") { // toastr.success(''+data.text); toastr.success( '' + data.text ); $(".signup_errmsg").html( '
Alert!
' + data.text + "
" ); } else { toastr.warning( '' + data.text ); } }, error: function (xhr, ajaxOptions, thrownError) { toastr.error( ' Failed! Something is wrong.' ); $("#st_regform_test_mail button[type='submit']").html( 'Create Account' ); $("#st_regform_test_mail button[type='submit']").removeAttr("disabled"); }, }); return false; }); $(".allow_name").keypress(function (e) { validationForAllow_name(e); }); function validationForAllow_name(e) { var regex = new RegExp(/^([a-zA-Z\s])+$/); var str = String.fromCharCode(!e.charCode ? e.which : e.charCode); if (regex.test(str)) { return true; } e.preventDefault(); return false; } $(".allow_name_number").keypress(function (e) { validationForAllow_name_number(e); }); function validationForAllow_name_number(e) { var regex = new RegExp(/^([a-zA-Z0-9])+$/); var str = String.fromCharCode(!e.charCode ? e.which : e.charCode); if (regex.test(str)) { return true; } e.preventDefault(); return false; } $(".allow_name_number_schar").keypress(function (e) { validationForAllow_name_number_schar(e); }); function validationForAllow_name_number_schar(e) { var regex = new RegExp(/^[0-9a-zA-Z/-]+$/); var str = String.fromCharCode(!e.charCode ? e.which : e.charCode); if (regex.test(str)) { return true; } e.preventDefault(); return false; } $(".allow_number").keypress(function (e) { validationForAllow_number(e); }); function validationForAllow_number(e) { var regex = new RegExp(/^[0-9]+$/); var str = String.fromCharCode(!e.charCode ? e.which : e.charCode); if (regex.test(str)) { return true; } e.preventDefault(); return false; } // $(".allow_name").bind('keyup blur',function(){ // var node = $(this); // node.val(node.val().match(/^[a-zA-Z ]*$/) ); // }); // $(".allow_name_number").bind('keyup blur',function(){ // var node = $(this); // node.val(node.val().match(/^[a-zA-Z0-9]*$/) ); // }); // $(".allow_name_number_schar").bind('keyup blur',function(){ // var node = $(this); // node.val(node.val().match(/^[0-9a-zA-Z/ -]+$/) ); // }); // $(".allow_number").on('keydown',function(e){ // var node = $(this); // node.val(node.val().match(/^[0-9 ]+$/) ); // }); $(".allow_decimal").keypress(function (e) { validationForAllow_decimal(e); }); function validationForAllow_decimal(e) { var regex = new RegExp(/^[\d*\.?\d]+$/); var str = String.fromCharCode(!e.charCode ? e.which : e.charCode); if (regex.test(str)) { return true; } e.preventDefault(); return false; } // $(".allow_decimal").on('keydown',function(e){ // var node = $(this); // node.val(node.val().match(/^\d*\.?\d*$/) ); // }); }); function validateEmail(email) { var email_val = $("#" + email).val(); var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (regex.test(email_val)) { //return false; } else { $("#" + email).val(""); $("#" + email).focus(); toastr.warning( ' Invalid Email ID' ); } } function validatePhone(phone) { var phone_val = $("#" + phone).val(); var regex = /^[0-9]{10}$/; if (regex.test(phone_val)) { //return false; } else { $("#" + phone).val(""); $("#" + phone).focus(); toastr.warning( ' Invalid Phone No' ); } } // // function validateHs_reg_year(hs_reg_year) { var hs_reg_year_val = $("#" + hs_reg_year).val(); if (hs_reg_year_val != "" && hs_reg_year_val >= 2011) { $(".hs_reg_msg").html( 'XXXXXXXXXX 10 Digits'); } else{ $(".hs_reg_msg").html( 'XXXXXXXXX 9 Digits'); } } // For Validation minimum char in hs-registration function validateHs_reg(hs_regno) { // alert("hii"); var hs_reg_year_val = $("#hs_reg_year").val(); if (hs_reg_year_val != "" && hs_reg_year_val >= 2011) { var hs_regno_val = $("#" + hs_regno).val(); var regex = /^([0-9a-zA-Z/-]){10}$/; if (regex.test(hs_regno_val)) { //return false; } else { $("#" + hs_regno).val(""); $("#" + hs_regno).focus(); toastr.warning( ' Invalid Registration No. Please Enter Valid Registration No.' ); } } else { var hs_regno_val = $("#" + hs_regno).val(); //var regex = /^([0-9a-zA-Z/-]){1,6}$/; var regex = /^([0-9a-zA-Z/-]){9}$/; if (regex.test(hs_regno_val)) { //return false; } else { $("#" + hs_regno).val(""); $("#" + hs_regno).focus(); toastr.warning( ' Invalid Registration No. Please Enter Valid Registration No.' ); } } } // For Validation minimum char in hs-registration function validateaadhaar_no(aadhaar_no) { var aadhaar_no_val = $("#" + aadhaar_no).val(); var regex = /^([0-9a-zA-Z/ -]){12,12}$/; if (regex.test(aadhaar_no_val)) { //return false; } else { $("#" + aadhaar_no).val(""); $("#" + aadhaar_no).focus(); toastr.warning( ' Invalid aadhaar no. Enter 12 digit no' ); } } // For Validation minimum char in First-Name function validateFname(fname) { var fname_val = $("#" + fname).val(); var regex = /^([a-zA-Z\s]){2,50}$/; if (regex.test(fname_val)) { //return false; } else { $("#" + fname).val(""); $("#" + fname).focus(); toastr.warning( ' Invalid Firse Name. Enter Minimum 2 and Maximum 50 Charecters' ); } } // For Validation minimum char in First-Name function validateMname(mname) { var mname_val = $("#" + mname).val(); var regex = /^([a-zA-Z]){2,24}$/; if (regex.test(mname_val)) { //return false; } else { $("#" + mname).val(""); $("#" + mname).focus(); toastr.warning( ' Invalid Middle Name. Enter Minimum 2 and Maximum 24 Charecters' ); } } // For Validation minimum char in Last-Name function validateLname(lname) { var lname_val = $("#" + lname).val(); var regex = /^([a-zA-Z\s]){2,50}$/; if (regex.test(lname_val)) { //return false; } else { $("#" + lname).val(""); $("#" + lname).focus(); toastr.warning( ' Invalid Last Name. Enter Minimum 2 and Maximum 50 Characters' ); } } // For Validation minimum char in Last-Name function validatePassword(password) { var password_val = $("#" + password).val(); var regex = /^([0-9a-zA-Z/#?!@$%^&*-+]){4,30}$/; if (regex.test(password_val)) { //return false; } else { $("#" + password).val(""); $("#" + password).focus(); toastr.warning( ' Invalid Password. Enter minimum 4 and maximum 30 characters' ); } } function validateConfirm_password(confirm_password) { var confirm_password_val = $("#" + confirm_password).val(); var regex = /^([0-9a-zA-Z/#?!@$%^&*-+]){4,30}$/; if (regex.test(confirm_password_val)) { //return false; } else { $("#" + confirm_password).val(""); $("#" + confirm_password).focus(); toastr.warning( ' Invalid Confirm Password. Enter minimum 4 and maximum 30 characters' ); } } // function send_otp() { var error = ""; $("#signup_otp_btn").html('Please wait'); $("#signup_otp_btn").addClass("disabled"); $.ajax({ url: "https://wbchseapp.wb.gov.in/portal/register-send-otp", type: "POST", dataType: "json", data: new FormData($("#st_regform")[0]), async: true, contentType: false, cache: false, processData: false, success: function (data) { toast_type = data.type; $("#signup_otp_btn").html("Send OTP"); $("#signup_otp_btn").removeClass("disabled"); $("#show_otp").val(data.otp); toastr.clear(); toastr.options = { closeButton: true, debug: false, newestOnTop: true, progressBar: false, positionClass: "toast-bottom-center", preventDuplicates: true, showDuration: "1000", hideDuration: "10000", timeOut: "2000", extendedTimeOut: "1000", }; if (toast_type == "success") { toastr.success( '' + data.text ); $(".otp_btn").addClass("hide"); $(".otp_text").removeClass("hide"); $(".signup_errmsg").html( '
Alert!
' + data.text + "
" ); } else { toastr.warning( '' + data.text ); $(".otp_btn").removeClass("hide"); $(".otp_text").addClass("hide"); toastr.warning( '' + data.text ); $(".signup_errmsg").html( '
Alert!
' + data.text + "
" ); } }, error: function (xhr, ajaxOptions, thrownError) { toastr.clear(); toastr.options = { closeButton: true, debug: false, newestOnTop: true, progressBar: false, positionClass: "toast-bottom-center", preventDuplicates: true, showDuration: "6000", hideDuration: "10000", timeOut: "3000", extendedTimeOut: "2000", }; toastr.error( ' Failed! Something is wrong.' ); $("#signup_otp_btn").html("Send OTP"); $("#signup_otp_btn").removeClass("disabled"); }, }); return false; } $("#otp_verification_regn_btn").click(function () { var error = ""; $("#otp_verification_regn_btn").html( 'Please wait' ); $("#otp_verification_regn_btn").addClass("disabled"); $.ajax({ url: "https://wbchseapp.wb.gov.in/portal/register-re-send-otp", type: "POST", dataType: "json", data: new FormData($("#st_regform")[0]), async: true, contentType: false, cache: false, processData: false, success: function (data) { toast_type = data.type; $("#otp_verification_regn_btn").html( '' ); $("#otp_verification_regn_btn").removeClass("disabled"); toastr.clear(); toastr.options = { closeButton: true, debug: false, newestOnTop: true, progressBar: false, positionClass: "toast-bottom-center", preventDuplicates: true, showDuration: "1000", hideDuration: "10000", timeOut: "2000", extendedTimeOut: "1000", }; if (toast_type == "success") { toastr.success( '' + data.text ); $(".signup_errmsg").html( '
Alert!
' + data.text + "
" ); } else { toastr.warning( '' + data.text ); $(".signup_errmsg").html( '
Alert!
' + data.text + "
" ); } }, error: function (xhr, ajaxOptions, thrownError) { toastr.clear(); toastr.options = { closeButton: true, debug: false, newestOnTop: true, progressBar: false, positionClass: "toast-bottom-center", preventDuplicates: true, showDuration: "6000", hideDuration: "10000", timeOut: "3000", extendedTimeOut: "2000", }; toastr.error( ' Failed! Something is wrong.' ); $("#otp_verification_regn_btn").html( '' ); $("#otp_verification_regn_btn").removeClass("disabled"); }, }); return false; });