1)How to edit a sharepoint page like Newform.aspx, EditForm.aspx, DisplayForm.aspx in MOSS?
There are 2 ways to do this: -
1) Use Sharepoint designer which is free. Open the site and edit the specific page.
2) However, If you do not want to use SharePoint designer due to some reason then here is the trick which you can use. Just add
"&ToolPaneView=2" to the end of the specific page's url so that you’re URL will be like this: -
http://litware/... /Lists/Demo/NewForm.aspx?RootFolder...&Source=…&ToolPaneView=2
http://litware/... /Lists/Demo/EditForm.aspx?RootFolder...&Source=…&ToolPaneView=2
http://litware/... /Lists/Demo/DispForm.aspx?RootFolder...&Source=…&ToolPaneView=2
Now refresh the page or hit enter. Now go to Sites Actions menu and you will be able to see "Edit Page" link.
2)SharePoint 2007 – Hiding fields on NewForm.aspx and EditForm.aspx
Many developers find it difficult to hide fields from
appearing in the form(NewForm.aspx,
EditForm.aspx). By default all columns in a list or document
library will appear in your forms.
However, we can do this by using JavaScript within the form pages themselves. I found several different sets of JavaScript code, some of the scripts are easier to implement than others. Below I am providing the best and most straight forward JavaScript and some simple
steps to guide you along.
To hide fields in a SharePoint 2007 form, follow these steps (I will use the NewForm.aspx in my example)
- Open SharePoint Designer and navigate to the site that contains the list or document library you wish to customize.
- Expand the folder named “Forms” under the desired list or document library. You should see about seven .aspx pages (AllItems.aspx, EditForm.aspx, NewForm.aspx, etc)
- Open the NewForm.aspx page and switch to the “code” view to edit the HTML of the page.
- Paste the JavaScript code immediately below the the following HTML tag <asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”> This will add the JavaScript to the HTML inside the content placeholder tag. Note: be sure to include the entire script below, including the <script and </script> tags.
- Modify the “hidefields()” section of the JavaScript code to refer to each SharePoint list field name to hide. For example, the code sample below will hide the SharePoint fields named Title, Document Link, and PublishDate Notice that you do not need to worry about internal field names or field types like other JavaScript techniques, you simply need to know the name of the field.
- Save the changes. Select “Yes” when prompted to “…customize the page from the site definition…”
- Test the form
<script language="javascript" type="text/javascript"> _spBodyOnLoadFunctionNames.push("hideFields"); function findacontrol(FieldName) { var arr = document.getElementsByTagName("!"); // get all comments for (var i=0;i < arr.length; i++ ) { // now match the field name if (arr[i].innerHTML.indexOf(FieldName) > 0) { return arr[i]; } } } function hideFields() { var control = findacontrol("Title"); control.parentNode.parentNode.style.display="none"; control = findacontrol("Document Link"); control.parentNode.parentNode.style.display="none"; control = findacontrol("PublishDate"); control.parentNode.parentNode.style.display="none"; } </script>
***********************************************************************
Looking for cheap Business Process Management Solutions for your Business?
Visit official website of Enterprise Connections http://entconn.co.uk
***********************************************************************
Official Blog http://droidzoom.blogspot.co.uk/
***********************************************************************
No comments:
Post a Comment