To ensure unique values in DataView web parts, refer the following link.
http://blogs.msdn.com/frontpoint/archive/2005/02/08/369249.aspx
Wednesday, February 17, 2010
Tuesday, February 16, 2010
Hide Delete Item Option in Form Toolbar of Custom List Form using SPD
To Hide the Delete Item option from the Form Toolbar using Javascript in SPD, use the following javascript function
function HideDeleteItem()
{
var aList=document.getElementsByTagName("a");
for(i=0;i {
if(aList[i].innerHTML=="Delete Item")
{
aList[i].parentElement.parentElement.style.display="none";
}
}
}
This can also be achieved using jQuery.
$(document).ready(function() {
$(”td.ms-titlearea”).hide();
$(”a[title='Delete Item']“).parent().parent().parent().hide();
$(”td.ms-separator:nth-child(4)”).hide();
});
The advantage of using this jQuery is that it also hides the separator whereas the other normal function doesn't help to achieve this.
function HideDeleteItem()
{
var aList=document.getElementsByTagName("a");
for(i=0;i
if(aList[i].innerHTML=="Delete Item")
{
aList[i].parentElement.parentElement.style.display="none";
}
}
}
This can also be achieved using jQuery.
$(document).ready(function() {
$(”td.ms-titlearea”).hide();
$(”a[title='Delete Item']“).parent().parent().parent().hide();
$(”td.ms-separator:nth-child(4)”).hide();
});
The advantage of using this jQuery is that it also hides the separator whereas the other normal function doesn't help to achieve this.
Remove {generate-id()} from a Custom List Form using SPD
I created a custom aspx page in SPD and added a Custom List Form web part in it for the Edit item. I assigned some id attributes to some rows in it. As soon as I saved it, I noticed that SPD is appending a {generate-id()} value to it and upon rendering, the assigned id was appended with some characters like ID0EAAA. Because of this, I was having some issues in referring these rows in Javascript. Upon googling, I found an excellent article which explains how to get rid of these.
http://blog.metrostarsystems.com/2007/09/14/how-to-remove-generate-id-from-a-customized-form/
http://blog.metrostarsystems.com/2007/09/14/how-to-remove-generate-id-from-a-customized-form/
Monday, February 15, 2010
Form OnSubmit & Body OnLoad for a Custom List Form in SPD 2007
We know that in SharePoint, every page is associated with a master page. So we will not have a <Form> tag in it. So it becomes difficult to capture OnSubmit event. But the following post gives a very good explanation on how to achieve this.
http://edinkapic.blogspot.com/2007/10/add-javascript-date-validation-into.html
To achieve the OnLoad event for the <Body> tag, use the following function call
_spBodyOnLoadFunctionNames.push("ExecuteMyFunctionOnLoad");
Thanks to the following link
http://meherkanthch.blogspot.com/2009/01/how-to-add-onload-javascript-event-in.html
http://edinkapic.blogspot.com/2007/10/add-javascript-date-validation-into.html
To achieve the OnLoad event for the <Body> tag, use the following function call
_spBodyOnLoadFunctionNames.push("ExecuteMyFunctionOnLoad");
Thanks to the following link
http://meherkanthch.blogspot.com/2009/01/how-to-add-onload-javascript-event-in.html
Hide Delete Item from Form Tool Bar of Custom List Form using SPD 2007
To hide the Delete Item option from the Form toolbar of a Custom List Form using SharePoint Designer 2007, use the following Javascript in the <Body> tag's OnLoad event.
function HideDeleteItem()
{
var aList=document.getElementsByTagName("a");
for(i=0;i {
if(aList[i].innerHTML=="Delete Item")
{
aList[i].parentElement.parentElement.style.display="none";
}
}
}
OR
use the following lines of jQuery in a javascript function.
$(document).ready(function() {
$("td.ms-titlearea").hide();
$("a[title='Delete Item']").parent().parent().parent().hide();
$("td.ms-separator:nth-child(4)").hide();
});
Note: Download and refer a copy of the latest jQuery script file for this to work.
function HideDeleteItem()
{
var aList=document.getElementsByTagName("a");
for(i=0;i
if(aList[i].innerHTML=="Delete Item")
{
aList[i].parentElement.parentElement.style.display="none";
}
}
}
OR
use the following lines of jQuery in a javascript function.
$(document).ready(function() {
$("td.ms-titlearea").hide();
$("a[title='Delete Item']").parent().parent().parent().hide();
$("td.ms-separator:nth-child(4)").hide();
});
Note: Download and refer a copy of the latest jQuery script file for this to work.
Enable Attachments in Custom List Form in Edit Mode in SPD 2007
Whenever we have a custom list form web part in an aspx page (in new/edit/display mode), the "Attach" link doesn't work. It gives an error. Refer the following Microsoft KB article for the error and its resolution.
http://support.microsoft.com/kb/953271
http://support.microsoft.com/kb/953271
Attachment Required Validation for Custom List Form in SharePoint Designer 2007
I have a Custom List Form for Edit Item in a custom aspx page developed using SharePoint Designer. There was a requirement in this. There should be a check for attachments,i.e. attachments should be made mandatory. This had to be achieved through Javascript. The following function helped in achieving the same. Note: This function should be called in the OnSubmit event of the form. Also, don't change the
id "idAttachmentsTable"
function CheckForAttachments()
{
var elm = document.getElementById("idAttachmentsTable");
if (elm == null || elm.rows.length == 0)
{
//document.getElementById("idAttachmentsRow").style.display='none';
alert("Please attach Documents");
return false ;
}
else { return true ;}
}
id "idAttachmentsTable"
function CheckForAttachments()
{
var elm = document.getElementById("idAttachmentsTable");
if (elm == null || elm.rows.length == 0)
{
//document.getElementById("idAttachmentsRow").style.display='none';
alert("Please attach Documents");
return false ;
}
else { return true ;}
}
Subscribe to:
Posts (Atom)