Sunday, July 15, 2012

Javascript Trim and Multiple Email Validation

function trim(str) {

if (!str

typeof str != 'string')

return null;

return str.replace(/^[\s]+/, '').replace(/[\s]+$/, '').replace(/[\s]{2,}/, ' ');

}

function emails(oSrc, args) {

var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

var address = args.Value;

var eadrs = address.split(';');



for (i = 0; i < eadrs.length; i++) {

var adr=trim(eadrs[i]);

if (adr != "" && adr != null)

if (reg.test(adr) == false) {

args.IsValid=false;

}

}

}
 





ClientValidationFunction="emails" ControlToValidate="TextBox2">

Tuesday, July 10, 2012

Clear People picker on dropdown change index in sp 2010


clearPicker()
{
var control;
var arr = document.getElementsByTagName("div");
for (var i = 0; i < arr.length; i++)
{
if (arr[i].id.indexOf("upLevelDiv") > 0)
{
control = arr[i];
}

}
control.innerHTML = '';
arr = document.getElementsByTagName("input");
for (var i = 0; i < arr.length; i++)
{
if (arr[i].name.indexOf("hiddenSpanData") > 0)
{
control = arr[i];
 }
}
control.value = '';
}

Wednesday, May 30, 2012

Open new modal popup while closising the parent modal popup.

Parent page code :

var siteUrl = http://siteurl/;

var modalpage = { url: siteUrl + "/_layouts/MyModal/Pages/NewModalForms.aspx", title: "New  Input Form", allowMaximize: false, width: 700, height: 300, showClose: true, dialogReturnValueCallback: silentCallback };

function openModalForm() {
SP.UI.ModalDialog.showModalDialog(modalpage);
}

function silentCallback(dialogResult, returnValue)
{

if (returnValue != null && returnValue != "")
{
OpenPopUpPageWithTitle(siteUrl + '/Lists/lst/NewForm.aspx?' + returnValue, RefreshOnDialogClose, null, null, 'New Modal Form');
}

}
 
Modalpopup page code
 
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.cancel, queryString);
 

Tuesday, May 22, 2012

How to Restore Deleted sitecollection in sharepoint 2010

Hi all  unfortunatly i have deleted  site collections in sharepoint 2010 . I am able to restored it using powerscript.


if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)


{
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
foreach($m in Get-SPDeletedSite)
{
Restore-SPDeletedSite -Identity $m
}

Sunday, April 8, 2012

Sharepoint Migration & Additions to this Web site have been blocked

How to Migrate MOSS 2007 to 2010
1. Take MOSS 2007 content DB backup
2. Create a DB in SQL Server and restore on it
3. Create a New Web Application in SP 2010
4. Central Admin > Manage Application >Manage Content Database > Select the specified DB
5. Select “Offline” and click on ok
6. repeat step 4 and select “Remove ContectDB “ Check Box >OK
7. Open Powershel and Use the following command
8. Mount-spcontentdatabase-Name “DBName” -WebApplication http://servername/webpallicationname
If You will get 403 error go to
Central Administration -> Application Management -> Configure Quotas and Locks
Set the Site Lock Information to "Not Lock" (it had been set to No Lock”)

Wednesday, November 16, 2011

BatchProcessing in Sharepoint on Lookup Field

<Method ID="1">
<SetList>71a9fac3-2e94-4246-8fec-41e30ea65b06</SetList>
<SetVar Name="Cmd">Save</SetVar>
<SetVar Name="ID">New</SetVar>
<SetVar Name="urn:schemas-microsoft-com:office:office#OrderDate">2009-2-21</SetVar>
<SetVar Name="urn:schemas-microsoft-com:office:office#OrderDateTime">2009-2-21</SetVar>>
<SetVar Name="urn:schemas-microsoft-com:office:office#CustomerID">1;#Cust_1</SetVar>
</Method>

Wednesday, October 5, 2011