Wednesday, September 17, 2008

Make Edit Page option available in list forms like NewForm.aspx, EditForm.aspx and DispForm.aspx

Most common question among SharePoint customization is that
“Why Edit Page option is not available in list forms like NewForm.aspx, EditForm.aspx and DispForm.aspx?”
If we need to edit New/Edit/Display Form of list most of the time we are using SharePoint designer. But here is the one nice trick to achieve this functionality. Just add “&ToolPaneView=2” at the end of the URL and refresh the page. So that you’re URL will be like this.
http://sharepointkings/... /Lists/Demo/NewForm.aspx?RootFolder...&Source=…&ToolPaneView=2 http://sharepointkings/... /Lists/Demo/EditForm.aspx?RootFolder...&Source=…&ToolPaneView=2 http://sharepointkings/... /Lists/Demo/DispForm.aspx?RootFolder...&Source=…&ToolPaneView=2
You can see add webpart tool pan beside this web part.

Just add or remove your webpart and your work is done. Updated :

Let's examine the command: The MSO presumably stands for Microsoft Office, the TlPn (that's a lowercase L not a 1 and unfortunately JavaScript is case sensitive) presumably stands for Tool Pane, and ShowToolPane is the specific method that we are executing. The required ViewID parameter identifies which Tool Pane view to show:

ViewID Tool Pane view to show
-1 Extensible View
0 Close task pane
1 Web Part Properties and Custom ToolParts
2 Add Web Parts – Browse
3 Add Web Parts – Search
4 Navigation (Downlevel only)
5 Add Web Parts – Import
6 Web Part Menu (Downlevel only)
7 Error

Monday, September 15, 2008

Using Javascript to Hide fields in Editform.aspx and Newform.aspx

Methods of Hiding column entry tab from newform.aspx and editform.aspx forms

Method 1 : The first solution is to customize NewForm.aspx from SharePoint Designer and replace the default list form with Custom List Form, in which you can remove the fields you don't need.

Method 2 : Next is to customize NewForm.aspx and add a JavaScript code that hides the whole row the field is placed.

We have implemented method 2 for the system implementation. We will discuss it in detail.

getTagFromIdentifierAndTitle

The most important part of our solution is the “getTagFromIdentifier” function. This function finds the HTML element rendered by a given SharePoint FormField control. It takes the following parameters:

  • tagName – The name of the tag rendered in the form’s HTML
  • identifier – The string associated with the SharePoint type of the relevant field
  • title – The value of the relevant HTML tag’s “title” attribute, which also matches the field’s display name

Here’s a partial table of SharePoint column types and their corresponding “identifiers” and “tagNames”:

SharePoint Field Type

Identifier

tagName

Single Line of Text

TextField

input

Multiple Lines of Text

TextField

textarea

Number

TextField

input

Currency

TextField

input

Choice (dropdown)

DropDownChoice

select

Lookup (single)

Lookup

select

Lookup (multiple)

SelectCandidate; SelectResult

select

Yes/No

BooleanField

input

Date Time

DateTimeFieldDate

input

For hiding “Assigned to” field:: getTagFromIdentifierAndTitle("div", "", "People Picker");

JavaScript code :

<script language="javascript" type="text/javascript">

_spBodyOnLoadFunctionNames.push("hideFields");

function hideFields() {

var control = getTagFromIdentifierAndTitle("TAGNAME","IDENTIFIER","FIELD NAME");

control.parentNode.parentNode.parentNode.style.display="none";

}

function getTagFromIdentifierAndTitle(tagName, identifier, title)

{

var len = identifier.length;

var tags = document.getElementsByTagName(tagName);

for (var i=0; i[tags.length; i++)

{

var tempString = tags[i].id;

if (tags[i].title == title && (identifier == ""

tempString.indexOf(identifier) == tempString.length - len))

{

return tags[i];

}

}

return null;

}

[/script]

Thursday, April 24, 2008

RootComponent types in solution.xml file in Dynamics CRM 365/2016

In Microsoft Dynamic CRM 2016/365 are you as confused as me when looking at the solution.xml from the solution export? looking at the xml a...