Untitled

mail@pastecode.io avatar
unknown
plain_text
20 days ago
1.9 kB
2
Indexable
Never
var errorSpanId = 'pincodeError';
      if (pin_code !== 0)  {
        if (country === 'IN' && pin_code != 6) {
            //showToast('Please enter a 6-digit PIN Code for India.', 'toastContainer');
            updatePincodeErrorMessage('Please enter a 6-digit PIN Code for India.', errorSpanId);
        $("#id_0-pin_code").val('').focus();
      }
      else{
        updatePincodeErrorMessage('', errorSpanId);
        }
     }
     
    }
    function updatePincodeErrorMessage(message, errorSpanId) {
        $('#' + errorSpanId).text(message);
    }








var errorSpanId = 'stateError';

    if (country !== 'IN' && $("#id_0-state").val() !== '30') {
        //showToast('Please select out of India in State field as Country is not India.', 'toastContainer');
        updateStateErrorMessage('Please select Outside India in State field as Country is not India.', errorSpanId);
        $("#id_0-state").val('');
    }
    else{
        updateStateErrorMessage('', errorSpanId);
    }  
    function updateStateErrorMessage(message, errorSpanId) {
        $('#' + errorSpanId).text(message);
    }










var errorSpanId = 'dobError';

        if (dateOfBirth) {
            var today = new Date();
            var selectedDate = new Date(dateOfBirth);
            var age = today.getFullYear() - selectedDate.getFullYear() - ((today.getMonth() < selectedDate.getMonth() || (today.getMonth() === selectedDate.getMonth() && today.getDate() < selectedDate.getDate())) ? 1 : 0);
            if (age < 17) {
                updateDobErrorMessage('Minimum age should be 17 years.', errorSpanId);
                $(this).val('');
            }
            else{
                updateDobErrorMessage('', errorSpanId);
            }
        }
    });
    function updateDobErrorMessage(message, errorSpanId) {
        $('#' + errorSpanId).text(message);
    }
Leave a Comment