Search This Blog

Tuesday, August 16, 2016

Customization Of Edit Page In SharePoint 2013

<script src="../../SiteAssets/Scripts/jquery-1.11.2.min.js" type="text/javascript"></script>
<script src="../../SiteAssets/Scripts/jquery.plugin.js" type="text/javascript"></script>
<script src="../../SiteAssets/Scripts/jquery.timeentry.js" type="text/javascript"></script>
 
<script type="text/javascript">
$(document).ready(function(){
 
 
                                                $("h3.ms-standardheader nobr").each(function(){
                                               
                                                var title=$(this).text();
                                                if(title=='Title')
                                                {
                                                                $("<span style=\"color:red;margin-left:3px;\">*</span>").insertAfter($(this));                
                                                }
    //do something with the element here.
                                });
                               
      $("#s4-ribbonrow").css('display','none');
      $("ms-toolbar").css('display','none');
      $("#DiffUTCLocalTime").css('display','none');
      $("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff11_ctl00_ctl00_TextField").attr("maxlength", 20);
    
     // Start Value Load In Meeting Time
     if($("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff111_ctl00_ctl00_TextField").val()!="")
      {
        var EditMode=$("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff111_ctl00_ctl00_TextField").val();
        $("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff111_ctl00_ctl00_TextField").val(EditMode);
      }
      else
      {
        //var finalstring="00:00";
        //$("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff111_ctl00_ctl00_TextField").val(finalstring);
 
      }
    //Start
   
   
      var dateLocal = new Date()
      var UTCLocalDiffrences=dateLocal.getTimezoneOffset();
      $("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff121_ctl00_ctl00_TextField").val(UTCLocalDiffrences);
      $('#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff111_ctl00_ctl00_TextField').timeEntry({show24Hours: true,showSeconds: false});
 
        // Title
                                $('#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff11_ctl00_ctl00_TextField').bind('keypress', function (event) {
                                //var regex = new RegExp("^[a-zA-Z0-9]+$");
                                var regex = /^[A-Za-z0-9_\(\)\[\]\s\-]*$/
                                var key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
                                if (!regex.test(key)) {
                                      event.preventDefault();
                                      return false;
                                   }
                                });
               
               
       //     Description
                    $('#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff21_ctl00_ctl00_TextField').bind('keypress', function (event) {
                                    //var regex = new RegExp("^[a-zA-Z0-9]+$");
                                   // var key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
                                    if (event.keyCode==34) {
                                       event.preventDefault();
                                       return false;
                                    }
                                });
                  
                                //Meeting Title 
                               
                                 $('#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff91_ctl00_ctl00_TextField').bind('keypress', function (event) {
                                    //var regex = new RegExp("^[a-zA-Z0-9]+$");
                                   // var key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
                                    if (event.keyCode==34) {
                                       event.preventDefault();
                                       return false;
                                    }
                                });
                                //Meeting Venue
                               
                                 $('#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff101_ctl00_ctl00_TextField').bind('keypress', function (event) {
                                    //var regex = new RegExp("^[a-zA-Z0-9]+$");
                                   // var key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
                                    if (event.keyCode==34) {
                                       event.preventDefault();
                                       return false;
                                    }
                                });
  
    
 
        /// Paste Blocking
     
           // Title
           var controls = $("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff11_ctl00_ctl00_TextField");
            controls.bind("paste", function () {
                return false;
            });
         
           var controls = $("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff11_ctl00_ctl00_TextField");
            controls.bind("copy", function () {
                return false;
            });
           
          //Description
           var controls = $("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff21_ctl00_ctl00_TextField");
            controls.bind("paste", function () {
                return false;
            });
 
            var controls = $("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff11_ctl00_ctl00_TextField");
            controls.bind("copy", function () {
                return false;
            });
           
           //Meeting Title 
           var controls = $("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff91_ctl00_ctl00_TextField");
            controls.bind("paste", function () {
                return false;
            });
          var controls = $("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff11_ctl00_ctl00_TextField");
            controls.bind("copy", function () {
                return false;
            });
 
            //Meeting Venue
            var controls = $("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff101_ctl00_ctl00_TextField");
            controls.bind("paste", function () {
                return false;
            });
           
            
           var controls = $("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff11_ctl00_ctl00_TextField");
            controls.bind("copy", function () {
                return false;
            });
            // Meating Time Label Size
            $("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff111_ctl00_ctl00_TextField").width(40);
           
           
 
        // How to set User Message On By On Display The Message
 
                  
         
           
           var startDate=$("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff31_ctl00_ctl00_DateTimeField_DateTimeFieldDate").val();
                                   // alert(startDate);
                                   var EndDate=$("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff41_ctl00_ctl00_DateTimeField_DateTimeFieldDate").val()
                                    //alert(EndDate);
           var Meetingdate=$("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_ff81_ctl00_ctl00_DateTimeField_DateTimeFieldDate").val()
            //alert(Meetingdate);
                                   if(Date.parse(EndDate)<= Date.parse(startDate))
                                   {
                                   $("span[class=ms-formvalidation]:contains('Em3UserMessage')").text('Document Visible End Date should be greater than Document Visible Start Date');
                                   }
                                   else if(Date.parse(Meetingdate)>= Date.parse(EndDate)||Date.parse(Meetingdate)<= Date.parse(startDate))
                                   {
                                    $("span[class=ms-formvalidation]:contains('Em3UserMessage')").text('Meeting Date Should be between  Document Visible Start date and Document Visible End Date');
                                   }
  
});
 
 
//$(window).bind("load", function() {
     //$(".ms-formvalidation").each(function(){
                                                // alert($('.ms-formvalidation').text());
    //do something with the element here.
                                //});
    //Geting the Error Message on click Button
                                   //$("#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_savebutton2_ctl00_diidIOSaveItem").click(function(){
                                   
                                   // alert($('.ms-formvalidation').text());
                                   // alert($('.ms-formvalidation').html());
                                  // // alert("The paragraph was clicked.");
                                // });
                                 
                                  //$( "#ctl00_ctl40_g_e6976881_6e0a_4bc0_9f7b_c3a65fb46704_savebutton2_ctl00_diidIOSaveItem" ).trigger( "click" );
//});
 
 
</script>

No comments:

Post a Comment