Thursday, April 16, 2015

Show alert in add new list item and show confirm in cacel button click

Create a JS file and place the below code

function CancelEvent()
{
if (confirm(confMessage)) {
    return true;
}
else
{
    e.preventDefault();
}
}

function SaveEvent()
{
   alert(saveMessage);
}

function addHandler()
{
$("input[id$=SaveItem]").attr("onclick","SaveEvent();" + $("input[id$=SaveItem]").attr("onclick"));
$("input[id$=diidIOGoBack]").attr("onclick","CancelEvent();" + $("input[id$=diidIOGoBack]").attr("onclick"));
}
_spBodyOnLoadFunctionNames.push('addHandler');

Put this in content editor webpart
<script src="/....../js/NewFormScript.js"></script>
<script>
var confMessage="Confirm 'Ok' to Cancel or 'Cancel' to retain";
var saveMessage = "After saving the record, please start the workflow";
</script>


custom-redirect-after-creating-a-new-sharepoint-item
$(document).ready(function() {
 
    var button = $("input[id$=SaveItem]");
    // change redirection behavior
        button.removeAttr("onclick");
        button.click(function() {
            var elementName = $(this).attr("name");
            var aspForm = $("form[name=aspnetForm]");
            var oldPostbackUrl = aspForm.get(0).action;
            var currentSourceValue = GetUrlKeyValue("Source", true, oldPostbackUrl);
            var newPostbackUrl = oldPostbackUrl.replace(currentSourceValue, "MyRedirectionDestination.aspx");
 
            if (!PreSaveItem()) return false;
            WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(elementName, "", true, "", newPostbackUrl, false, true));
        });
     
});

 

Image noise comparison methods

 1. using reference image technique     - peak_signal_noise_ratio (PSNR)     - SSI 2. non-reference image technique     - BRISQUE python pac...