function showSuccessMessage(message){ if(message != null && message != 'null' && message.length > 0) { $('#mini-notification-success').find('p').html(message); $('#mini-notification-success').miniNotification({closeButton: true, closeButtonText: '[hide]'}); } } function showSuccessMessageIndex(message){ if(message != null && message != 'null' && message.length > 0) { $('#mini-notification-success').find('p').html(message); $('#mini-notification-success').miniNotification({closeButton: true, closeButtonText: '[hide]'}); $('#mini-notification-success').css("display","block"); } } function showFailureMessage(message){ if(message != null && message != 'null' && message.length > 0) { $('#mini-notification-error').find('p').html(message); $('#mini-notification-error').miniNotification({closeButton: true, closeButtonText: '[hide]'}); } } function resetValues(formElement, event) { /* If mouse right button was clicked then don't reset the form fields */ if(event.button === 2) { return false; } /* Clearing the inline validation error messages */ if($("#error").is(':visible')) { $(error).remove(); } $("div").remove('.errorInline'); /* Reset the values of form fields */ $(formElement).find(':input').not(':hidden, :submit, :button, :reset').each(function() { switch(this.type) { case 'password': case 'select-multiple': $(this).prop('selectedIndex',0); $('.bootstrap-duallistbox-container .removeall').trigger('click'); // to clear the values for "bootstrapDualListbox" break; case 'select-one': $(this).prop('selectedIndex',0).trigger('change'); break; case 'text': $(this).val('').prop('defaultValue',''); break; case 'textarea': case 'checkbox': case 'radio': } }); /* Make the focus on the first element when reset completes */ $("input[type='text'],[type='password']").not('hidden').first().focus(); return false; } function displayClientTime(date){ // getHours returns the hours in local time zone from 0 to 23 var hours = date.getHours() // getMinutes returns the minutes in local time zone from 0 to 59 var minutes = date.getMinutes() var meridiem = " AM" // convert to 12-hour time format if (hours > 12) { hours = hours - 12 meridiem = ' PM' } else if (hours === 0){ hours = 12 } // minutes should always be two digits long if (minutes < 10) { minutes = "0" + minutes.toString() } return hours + ':' + minutes + meridiem } function checkBlankOrEmpty(value, element) { var elementType = element.tagName.toLowerCase(); switch(elementType) { case 'select': return (element.value != elementType) && (element.value != '') ; break; case 'password': break; case 'text': return (element.value != '') break; case 'textarea': return (element.value != '') break; case 'checkbox': break; case 'radio': break; default: break; } } function measurePasswordStrength(password,username) { //Password should contain characters, numbers and special characters with length between 8 to 32 var passwordRegExp = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@%+\\/'!#$^?:.(){}\[\]~_\-])(?!.*\s)^([\w@%+\\/'!#$^?:.(){}\[\]~_\-]{8,32})$/; var emailCharacterPattern = /([@])/; // If password contains content of email splitted based on the delimiter '@' , then return false. // This requirement is not applicable for clientAdmin so not implementing this. //Password and username should not be same and Username should not be part of password. if (password.toUpperCase() == username.toUpperCase() || password.toUpperCase().indexOf(username.toUpperCase()) >= 0 && username.length > 0 ) { return false; } //if the password length is less than 8, return false. if (password.length < 8) { return false; } //if the password length is greater than 32, return false. if (password.length > 32) { return false; } if (!passwordRegExp.test(password)) { return false; } return true; } /* This function is to redirect a user to a specified location provided in the url parameter */ function redirectUser(url, event) { /* If mouse right button was clicked then don't reset the form fields */ if(event.button ==2) { return false; } window.location.href=url; } function goToDashboard(el,hrefContent){ let selectedDate = sessionStorage.getItem("selectedDate"); let testcenterId = sessionStorage.getItem("testcenterId"); let selectedSession = sessionStorage.getItem("selectedSession"); let destination=hrefContent+'?fromDatePicker='+ selectedDate +'&TestCenterName='+ testcenterId +'&Sessions=' + selectedSession; $(el).attr('href',destination); return false; } /* this method will refresh the parant page and load current content */ function reloadParentPageContent() { window.close(); window.opener.location.reload(); }