Posts

Showing posts with the label Java Script

Validation for Asp FileUpload Control using JavaScript

function validatefileuploadcontrol() { $( $( 'input[id*="FileUpload1"]' )).change( function () { var fileExtension = [ 'doc' , 'docx' ]; //Extensions if ($.inArray($( this ).val().split( '.' ).pop().toLowerCase(), fileExtension) == - 1 ) { alert( "'.doc', '.docx' formats are allowed." ); } }) }

SharePoint 2010: JavaScript Code To Check if user exists in a group (ECMA)

//Call this function where you want IsCurrentUserMemberOfGroup( "GropuName" , function (isCurrentUserInGroup) { if (!isCurrentUserInGroup) { } }); //Below is the Function to Check whether the user exists in the group or not function IsCurrentUserMemberOfGroup(strGroupName, functionComplete) { //Setup Vars currentContext = null ; currentWeb = null ; allGroups = null ; leaderGroup = null ; currentUser = null ; groupUsers = null ; //Get an instance of the Client Content. currentContext = new SP.ClientContext.get_current(); //Grab the client web object. currentWeb = currentContext.get_web(); //Get the current user object currentUser = currentContext.get_web().get_currentUser(); currentContext.load(currentUse...

Disable all day event, Recurrence,Workspace Fields in Calendar list

Open the Newform.aspx in edit mode( <site>/Calendarlist/Newform.aspx?toolpaneview=2) and add the content editor webpart to below the form and paste the below script in html editor of the content editor web part. < script type = "text/javascript" > function HideField(title){ var header_h3 = document .getElementsByTagName( "h3" ) ; for ( var i = 0 ; i < header_h3.length; i ++ ) { var el = header_h3[i]; var foundField ; if (el.className == "ms-standardheader" ) { for ( var j = 0 ; j < el.childNodes.length; j ++ ) { if (el.childNodes[j].innerHTML == title || el.childNodes[j].nodeValue == title) { var elRow = el.parentNode.parentNode ; elRow.style.display = "none" ; //and hide the row foundField = true ; break ; } } } if (foundField) break ; } } HideField( ...

Navigate or redirect NewForm.aspx to another page (Sharepoint 2010)

Hi, Here i'm going to explain how to redirect the page from newform.aspx to another page after clicking the cancel or save buttons.  here i'm giving the small example: create a application page and paste the below script in PlaceHolderMain for the test purpose < script type = "text/javascript" > function openwindow() { window .open( "http://localhost:5010/Lists/TestList/NewForm.aspx?Source=/_layouts/ModelDailogBoxSolution/Closepage.aspx" , "mywindow" , "menubar=1,resizable=1,width=350,height=250" ); } < /script> <a href= "javascript: openwindow()" > testing </a> This is the test page, you can use this code according to your requirement

How to Hide Top Bar, Ribbon, Quick Launch in SharePoint 2010?

Hi, Here i'm going to explain How to Hide Top Bar, Ribbon, Quick Launch in SharePoint 2010. Top Bar, Ribbon, Quick Launch are come up with Application Pages by default. If you want to open the page in Dialog Framework then those elements will take more space and make the layout cluttered. One way to hide these controls is by passing a Parameter with the URL. [ ?IsDlg=1 ] SharePoint will hide these elements when It gets IsDlg Parameter on URL.  Eg:   http://localhost:5010/Lists/TestList/NewForm.aspx?IsDlg=1 But every time we can't pass these parameters. Then how to get rid of these elements? Simple Just add the below css Code in Application Page under PlaceHolderMain section. < style   type ="text/css">      #s4-ribbonrow ,  .ms-cui-topBar2 ,  .s4-notdlg ,  .s4-pr   s4-ribbonrowhidetitle ,  .s4-notdlg   noindex ,  #ms-cui-ribbonTopBars ,  #s4-titlerow ,  #s4-pr   s4-notdlg   s4-titlerowhideti...