TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Hiding Fields on NewForm and EditForm.aspx using Javscript
Sagar Pardeshi
Oct 02
2014
Code
1.4
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
<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>
Hiding fields on NewForm and EditForm.aspx