Showing posts with label Jquery. Show all posts
Showing posts with label Jquery. Show all posts

Monday, March 21, 2016

LookUp column Web URL Changing in Using Powershell Script

 Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue
$webURL = "http://site1/"
$listName = " Card Test"
$columnName = "Designation 2"
$lookupListName = "Designation Lookup"
$lookupWebURL = "http://site"

RepairListLookupColumns -webURL $webURL -listName $listName -columnName $columnName -lookupListName $lookupListName -lookupWeb $lookupWebURL
Function RepairListLookupColumns($webURL, $listName, $columnName, $lookupListName, $lookupWebURL)
{
#Get web, list and column objects
$web = Get-SPWeb $webURL
$lookupWeb = Get-SPWeb $lookupWebURL
$lookupWeb = Get-SPWeb $lookupWebURL
$list = $web.Lists[$listName]
$column = $list.Fields[$columnName]
$lookupList = $lookupWeb.Lists[$lookupListName]
$newLookupListID = "{"+$lookupList.ID.ToString()+"}"
$newLookupWebID = "{"+$lookupWeb.ID.ToString()+"}"

#Change schema XML on the lookup column
$column.SchemaXml = $column.SchemaXml.Replace($column.LookupWebId.ToString(), $newLookupWebID)

$column.SchemaXml = $column.SchemaXml.Replace($column.LookupList.ToString(), $newLookupListID)
$column.Update()

#Write confirmation to console and dispose of web object
write-host "In Site" $web.Url "column " $column.Title "in Liste" $list.Title "is connected with"  $lookupList.Title "from" $lookupWeb.Url
$web.Dispose()
$lookupWeb.Dispose()
}


Friday, March 18, 2016

Personal views in site migration using Import-Export


  •  (you will get customizations code personal views,
  • you will get customizations code workflows 
  • you will get customizations code alerts) 
  • you will get customizations code 
  • you will lost quick links 
  •  Sites based off old site templates are not handled
  •  During import, some files are dropped off due to the blocked items list.
  • There are some versioning and security issues as well.

Enable Anonymous Access in SharePoint 2013


  • Go to  Central Administration, Choose Application Management, select Manage web applications .
  • Select the site you want to enable anonymous access on and click on the Authentication Providers icon.
  • On the Authentication Providers pop-up window click on the Default zone.
  • Edit Authentication, Enable anonymous access and click Save.
  • Select Web Application Management click on the Anonymous Policy icon.
  • Under Anonymous Access Restrictions select your Zone and set the Permissions to None – No policy and click Save
  • Web application will allow anonymous access to be set. 
  • Navigate to your top level site collection for the web application. 
  • Site Actions > Site Settings. Under Users and Permissions click Site permissions
  • Permission Tools, Click Anonymous Access icon and set the permissions to Entire Web site

Resource Throttling in SharePoint 2013



  • monitoring and throttling server resources and large lists for Web applications. 
  • its enables you to control resource utilization during peak usage and prevent user activity from negatively affecting server performance. 



  1. General Settings Ribbon, select Resource Throttling.
  2. Enter values for the List View Threshold option.
  3.  This limits queries within a list to guard against performance degradation with too many list items. 
  4. In SharePoint Server 2013, a list can support up to 50 million items. 

Thursday, March 17, 2016

WSP gets stuck in "Deploying"


  • stsadm -o execadmsvcjobs on the server running Central Admin
  • Install-SPSolution has only the -Force, 
  • Check for Sharepoint 2013 Timer service






Add-SPSolution –LiteralPath "d:solution.wsp" 

install solution and we executed the following command:

Install-SPSolution -Identity "solution.wsp" -WebApplication http://peakfinders.com/  –GACDeployment

Import subsite and Site Collection in SharePoint power shell script

Import the subsite

STSADM:

stsadm -o import -url "http://sharepointsite/sites/order/" -filename D:\backup.cmp -includeusersecurity -versions 4

Powershell:

Add-pssnapin microsoft.sharepoint.powershell

Export-SPWeb -identity "http://sharepointsite/sites/order/"  -path D:\backup.cmp -includeusersecurity  -force

Export the Subsite moved to site Collection Using PowerShell

Export the subsite


STSADM:

stsadm -o export -url "http://sharepointsite/sites/order/" -filename D:\backup.cmp -includeusersecurity -versions 4


Powershell:


Add-pssnapin microsoft.sharepoint.powershell

Import-SPWeb -identity "http://sharepointsite/sites/order/"  -path D:\backup.cmp -includeusersecurity  -force

Tuesday, March 15, 2016

calculate the number of the week based on a date in a list?

Week starts on monday. Depending on your regional settings you have to replace the ; with ,

Example:

=IF(INT((StartDate-DATE(YEAR(StartDate);1;1)+(TEXT(WEEKDAY(DATE(YEAR(StartDate);1;1)-1);"d")))/7)=0;52;INT((StartDate-DATE(YEAR(StartDate);1;1)+(TEXT(WEEKDAY(DATE(YEAR(StartDate);1;1)-1);"d")))/7))


Example:

=INT(([Start Date]-DATE(YEAR([Start Date]),1,1)+(TEXT(WEEKDAY(DATE(YEAR([Start Date]),1,1)),”d”)))/7)+1

How to Backup & Restore a SharePoint Designer workflow and add it another site?


  • Go to the site you have the workflows on
  • Select Site Actions -> Edit in SharePoint Designer.
  • Select “All Files” in the Navigation, then click “Workflows”
  • Right-Click the workflow And go to “Copy”
  • SharePoint Designer. Go to your destination site.
  • Go to Site Actions -> Edit in SharePoint Designer.
  • Right Click and choose “Paste”. 
  • The workflows should be there, but they are not associated with the list 
  • SharePoint recognizes and attaches workflows to Lists and Libraries using their ListID. 
  • We can change that through the .xoml.wfconfig.xml
  • Select the “All Files” again in the navigation, then click “Workflows”, then click the workflow name.
  •  Open With -> SharePoint Designer (Open as XML).
  • Delete the ListID, and paste the ListID you copied earlier here.

Wednesday, March 2, 2016

Textbox toggle dropdown in Jquery?

<input ID="txtchktouser" CssClass="textbox_width ddllocation" onkeypress="return false;" onpaste="return false;"/>
<div id="locationlist" style="max-height: 400px; width: 300px; background: #fff; overflow: auto; border: 1px solid #999; display: none; position: absolute; top: 22px; left: 0px; z-index: 1000;">
<span class="spnval">Select Status</span><br>
<span class="spnval">Pending</span><br>
<span class="spnval">Completed</span><br>
<span class="spnval">Active</span><br>
<span class="spnval">In Tech Support</span><br>
<span class="spnval">IN Balancing</span><br>
<span class="spnval">Programmer working on it</span><br>
<span class="spnval">Other</span><br>
<span class="spnval">Held Next Bus. Day per COP</span><br>
<span class="spnval">Held Next Bus. Day per Prg</span><br>
<span class="spnval">Programmer was paged</span><br>
<span class="spnval">Programmer was notified</span><br>

<div id="divtouser"></div>
 </div>

$('#txtchktouser').bind('click', function () { $('#locationlist').toggle();

 });
 $(".spnval").click(function(){
 $("#txtchktouser").val($(this).text())
 $('#locationlist').toggle();
 })

Tuesday, February 23, 2016

Set Div position to Mouse position with jQuery

we are  trying to position my Div wherever the user clicks on textbox.Show a hidden div at mouse position when a text box is clicked
Here is the full code:
Jquery:

var id4com="";
 $('.txt4com').on('click',function (e) {
e.preventDefault();
// $('#4com').css( 'position', 'absolute' );
       var o = {
            left: e.pageX,
            top: e.pageY
        };
        $("#4com").show(200).offset(o);

 id4com=$(this).attr('id'); 
   });
 $(".sp4com").click(function(){

  $("#"+id4com).val($(this).text())
$('#4com').toggle();
 });
HTML

<div id="4com" class="divplace" style="min-width:100px;background: #fff; overflow: auto; border: 1px solid #999; display: none; ">

<span class="sp4com">LADC</span><br>
<span class="sp4com">All ZNA</span><br>
<span class="sp4com">Fore/ODC</span><br>
<span class="sp4com">LADC</span><br>
<span class="sp4com">ODC</span><br>
<span class="sp4com">ZNA</span><br>
<span class="sp4com">Foremost</span><br>
<span class="sp4com">ZDU (UUG)</span><br>
<span class="sp4com">Canada</span><br>
<span class="sp4com">REM</span><br>
<span class="sp4com">Other</span><br>
<span class="sp4com">N/A</span><br>
</div>

Wednesday, February 3, 2016

How to format currency by using JQuery?

HTML

<input type="text" id="txtvalue" />
Javascript 


var format = function(num){
var str = num.toString().replace("$", ""), parts = false, output = [], i = 1, formatted = null;
if(str.indexOf(".") > 0) {
parts = str.split(".");
str = parts[0];
}
str = str.split("").reverse();
for(var j = 0, len = str.length; j < len; j++) {
if(str[j] != ",") {
output.push(str[j]);
if(i%3 == 0 && j < (len - 1)) {
output.push(",");
}
i++;
}
}
formatted = output.reverse().join("");
return("$" + formatted + ((parts) ? "." + parts[1].substr(0, 2) : ""));
};
$(function(){
    $("#txtvalue").keyup(function(e){
        $(this).val(format($(this).val()));
    });
});

Friday, January 8, 2016

how to avoid duplicate values in dropdownlist using jquery

<select>
    <option>HR</option>
    <option>Software</option>
    <option>Software</option>
    <option>Hardware</option>
    <option>Hardware</option>

    <select>
Javascript/ JQuery:

$(document).ready(function () {
    var usedNames = {};
    $("select > option").each(function () {
        if (usedNames[this.value]) {
            $(this).remove();
        } else {
            usedNames[this.value] = this.text;
        }
    });
});
//Another Method
$(document).ready(function () {
$(".select option").text(function(i,v){
  $(this).siblings("[text="+ v +"]").remove();
});
});

Friday, January 1, 2016

Form validation password match in jquery

In this below script,Form validation password match in jquery

Form validation password match in jquery
HTML
<form id="details" action=''>
  <input type='text' id='password'/>
  <input type='text' id='repeatpass'/>
  <span id="matchpass"></span>
</form>

Script
function onLoad() {
    $("#password").keyup(passCheck);
    $("#repeatpass").keyup(passCheck);
}
function passCheck() {
    var password = $("#password").val();
    var repeatpass = $("#repeatpass").val();
    if (password == repeatpass) {
        $("#matchpass").text("Passwords match");
        $("#matchpass").addClass("valid");
        $("#matchpass").removeClass("error");
        $("#details").submit();

    } else {
        $("#matchpass").text("Passwords donot match");
        $("#matchpass").addClass("error");
        $("#matchpass").removeClass("valid");

    }
}
$(document).ready(onLoad);

Wednesday, December 30, 2015

How to

In this below script,Remove table border using jQuery/javascript

Remove table border using jQuery In SharePoint


Include this code console :

$("table[id='idAttachmentsTable'] tr td").css('border','none');


Sunday, December 27, 2015

Fancy box validation in JQuery

In this below script,Fancy box validation in JQuery/ javascript

Fancy box validation in JQuery in SharePoint
Script:
We have implemented Vaildation code here.


<script src="//code.jquery.com/jquery-1.11.3.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.2.8/jquery.form-validator.min.js"></script>
<script>
$(function () {
  $.validate({
    modules : 'location, date, security, file, toggleDisabled',
    validateOnBlur : false,
    showHelpOnFocus : false,
    addSuggestions : false,
    showErrorDialogs : false,
    errorMessagePosition : 'bottom', // Instead of 'element' which is default
    onError : function($form) {
      var msgErr = '';
      $form.find('span.form-error').each(function(index, element) {
        msgErr += '<p>' + $(element).text() + '</p>';
      });
      $('#errMsg').html(msgErr);
    }
  });
});</script>

HTML:
<p id="errMsg"></p>
<div id="form">
    <div id="form-top">
    </div>
    <div id="email-error-dialog0"></div>

    <form accept-charset="UTF-8"  class="infusion-form" method="POST">

        <div>
            <label>First Name:</label>
            <input class="infusion-field-input-container required" id="inf_field_FirstName" name="inf_field_FirstName"
                   type="text" placeholder="First Name" data-validation="letternumeric" data-validation-allowing=" "
                   data-validation-error-msg="Please enter your first name"/>
        </div>
        <div>
            <label>Last Name:</label>
            <input class="infusion-field-input-container" id="inf_field_LastName" name="inf_field_LastName" type="text"
                   placeholder="Last Name" data-validation="letternumeric" data-validation-allowing=" "/>
        </div>
        <div>
            <label>Address:</label>
            <input class="infusion-field-input-container" id="inf_field_StreetAddress1" name="inf_field_StreetAddress1"
                   type="text" placeholder="Your Address" data-validation="letternumeric" data-validation-allowing=" "/>
        </div>
        <div>
            <label>Country:</label>
            <select id="inf_field_Country" name="inf_field_Country" style="width:171px; height:18px;">
                <option value="United States" selected="selected">United States</option>
            </select>
        </div>
        <div>
            <label>State:</label>
            <select class="span2" name="inf_field_State" style="width:171px; height:18px;">
                <option value="AL">Alabama</option>
                <option value="AK">Alaska</option>
                <option value="AZ">Arizona</option>
                <option value="AR">Arkansas</option>
             
            </select>
        </div>
        <div>
            <label>City:</label>
            <input class="infusion-field-input-container" id="inf_field_City" name="inf_field_City" type="text"
                   placeholder="Your City" data-validation="alphanumeric"/>
        </div>

        <div>
            <label>Zip Code:</label>
            <input class="infusion-field-input-container" id="inf_field_PostalCode" name="inf_field_PostalCode"
                   type="text" placeholder="Zip Code" maxlength="5" data-validation="number"/>
        </div>

        <div>
            <label>Phone:</label>
            <input class="infusion-field-input-container" id="inf_field_Phone1" name="inf_field_Phone1" type="tel"
                   maxlength="10" style="text-indent:10px; margin-left:10px; width:165px;" placeholder="Phone"
                   data-validation="number"/>
        </div>
        <div>
            <label>Email:</label>
            <input class="infusion-field-input-container" id="inf_field_Email" name="inf_field_Email" type="email"
                   style="text-indent:10px; margin-left:10px; width:165px;" placeholder="Email Address"
                   data-validation="email"/>
        </div>
</div>
<div id="form-btm">
    <input type="submit" id="form-btn"/>
</div>
</form>

<p id="para"></p>

Create simple slider in Jquery &jQuery.remove()

In this below script,Create simple slider in Jquery &jQuery.remove()

Create simple slider in Jquery
SCRIPT:
$(document).ready(function()
{
    var AnimateGallery = function(item)
    {
        $(item).animate({left: "-=1"}, 20, 'linear', function()
        {
            // I tried to debug, testing if $(item) caught all the slides,
            // but it doesn't.
            $(item).attr("data-off", $(item).offset().left + $(item).width());
            $(item).attr("data-out", Boolean($(item).offset().left + $(item).width() < 100).toString());

            if(parseFloat($(item).attr("data-off")) < 0)
            {
                $(item).remove();
                // ^^^^ This one unexpectedly removes all the slides when the first one meets condition
            }
            else
                AnimateGallery($(item));
        });
    };

    $(".mp-gallery")
        .find(".mp-gallery-item")
        .each(function()
    {
        var $el = $(this);

        AnimateGallery($el);
    });
});

<style>
div.mp-gallery
{
    position: relative;
    top: 10%;
    left: 0;

    border: 1px solid black;

    background-color: #333;

    height: 40%;
    width: 100%;

    font-size: 0;

    box-shadow: 0 0 20px black;

    white-space: nowrap;
}

div.mp-gallery-item
{
    display: inline-block;

    width: calc(100% / 3);

    margin: 0;
    padding: 0;

    vertical-align: middle;

    font-size: 12pt;

    position: relative;
}
div.mp-gallery-item
{
    height: 100px;
}
div.mp-gallery-item-image
{
    cursor: pointer;

    height: 100%;
}
div.mp-gallery-item-text
{
    padding: 2%;

    vertical-align: middle;
    text-align: center;

    position: relative;
    top: -50%;

    background-color: rgba(0, 0, 0, 0.2);

    opacity: 1;

    color: white;
}</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="mp-gallery">
            <div class="mp-gallery-item" id="slide-1">
                <div class="mp-gallery-item-image" style="background-color: burlywood;">

                </div>
                <div class="mp-gallery-item-text">
                    Image Text
                </div>
            </div>
            <div class="mp-gallery-item" id="slide-2">
                <div class="mp-gallery-item-image" style="background-color: darkgreen;">

                </div>
                <div class="mp-gallery-item-text">
                    Image Text
                </div>
            </div>
            <div class="mp-gallery-item" id="slide-3">
                <div class="mp-gallery-item-image" style="background-color: darkseagreen;">

                </div>
                <div class="mp-gallery-item-text">
                    Image Text
                </div>
            </div>
            <div class="mp-gallery-item" id="slide-4">
                <div class="mp-gallery-item-image" style="background-color: cadetblue;">

                </div>
                <div class="mp-gallery-item-text">
                    Image Text
                </div>
            </div>
            <div class="mp-gallery-item" id="slide-5">
                <div class="mp-gallery-item-image" style="background-color: coral;">

                </div>
                <div class="mp-gallery-item-text">
                   Image Text
                </div>
            </div>
            <div class="mp-gallery-item" id="slide-6">
                <div class="mp-gallery-item-image" style="background-color: gainsboro;">

                </div>
                <div class="mp-gallery-item-text">
                    Image Text
                </div>
            </div>
        </div>
#jQuery.remove() 

How to bind image in Body tag in jquery or for loop in jquery

<html>
  <head>
    <meta charset="utf-8">
      <title>tes</title>
  </head>
  <body>
    <script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'></script>
    <script>
var image = $("<img>")
        .attr('src', 'peakcock.jpg')
        .attr('width', '10')
for(i = 0, i < 5, i++) {
            $(image).appendTo('body');  
        }
    </script>
  </body>
</html>

Thursday, December 24, 2015

Javascript replace all “%20” with a space

In this below script,add textbox time picker html using jQuery in SharePoint

add textbox time picker html
//Variable declaration
when we get url value automatically space replaced %20

 var k="Peak%20Finders";
Now we got the pefect value in jQuery

alert(k.replace(/%20/g, " "));

or

alert(k.replace("%20", " "));





#Jquery #javascript #space

Wednesday, December 16, 2015

Get current Date and time in Jquery

function formatDate(date) {

  return date.getMonth()+1 + "" + date.getDate() + "" + date.getFullYear() + "" + date.getHours()+""+ date.getMinutes()+""+date.getSeconds();
}

var d = new Date();
var e = formatDate(d);
alert(e);