Stump the Panel: SharePoint Q&A

Immediate solutions for common SharePoint questions
It is currently Sat May 25, 2013 12:49 am

All times are UTC - 5 hours [ DST ]


Forum rules


What you are viewing is an archive of Stump the Panel. It remains for reference purposes. Please post all new questions on NothingButSharePoint.com
https://www.nothingbutsharepoint.com/sites/eusp/Forum



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: Hide date created and created by...
PostPosted: Mon Apr 04, 2011 12:25 am 
Offline

Joined: Mon Sep 06, 2010 7:02 pm
Posts: 15
....on the dialogue window that pops up when you view a list item.
We want to keep comments anon and by default the date and the who are written to the bottom left of the form


Top
 Profile  
 
 Post subject: Re: Hide date created and created by...
PostPosted: Mon Apr 04, 2011 12:26 am 
Offline

Joined: Mon Sep 06, 2010 7:02 pm
Posts: 15
Sorry should have said.... SP 2010


Top
 Profile  
 
 Post subject: Re: Hide date created and created by...
PostPosted: Mon Apr 04, 2011 7:29 am 
Offline
User avatar

Joined: Sat Jan 02, 2010 6:02 pm
Posts: 1035
Location: Silver Spring, MD
You'll have to use a bit of jQuery for that. Are you familiar with how to add jQuery to your form page?

Here's the code btw:
Code:
$("#ctl00_MSO_ContentDiv a[href*='_layouts/userdisp.aspx?ID=']").each(function() {
   $(this).closest("span").remove();
});

Let me know if you need more help setting this up.


Top
 Profile  
 
 Post subject: Re: Hide date created and created by...
PostPosted: Mon Apr 04, 2011 4:41 pm 
Offline

Joined: Mon Sep 06, 2010 7:02 pm
Posts: 15
Were this a .net (non-SP) page or html I would know but I'm guessing it's not the same in SP designer/SP?
Do I go to the code view tab for DispForm.aspx and paste your code between a pair of <script> tags?


Top
 Profile  
 
 Post subject: Re: Hide date created and created by...
PostPosted: Tue Apr 05, 2011 8:15 am 
Offline
User avatar

Joined: Sat Jan 02, 2010 6:02 pm
Posts: 1035
Location: Silver Spring, MD
Hey JayP,
I just noticed we didn't have a sticky post anywhere describing how to do this. Look over this post and see if it helps clear up issues you have.

http://endusersharepoint.com/STP/viewto ... =13&t=3068


Top
 Profile  
 
 Post subject: Re: Hide date created and created by...
PostPosted: Tue Apr 05, 2011 4:20 pm 
Offline

Joined: Mon Sep 06, 2010 7:02 pm
Posts: 15
Thanks... might still be something missing (my knowledge)
I opened the list in SPD and clicked on dispform.aspx I then added a CEWP and saved the page.
I then visited the page in my browser and clicked on "list" on the ribbon.
From there I clicked on Form web parts and then selected and then default display form (pretty much guessing where to go/click at this stage).
Then I clicked inside the CEWP text part and chose HTML/Edit HTML source.
Then inside the HTML Source dialogue box I typed this...

<script language="javascript" type="text/javascript">
$("#ctl00_MSO_ContentDiv a[href*='_layouts/userdisp.aspx?ID=']").each(function() {
$(this).closest("span").remove();
});</script>

Then I moved out of editing mode and browsed the list.
When I click on a list item to view in the dialogue box I still see the:
Created at 17/02/2011 1:34 p.m. by xxxxxx
Last modified at 17/02/2011 1:34 p.m. by xxxxxx

Is the Javascript tag incorrectly declared for jquery?
is userdisp.aspx the correct url for this dialogue box?


Top
 Profile  
 
 Post subject: Re: Hide date created and created by...
PostPosted: Tue Apr 05, 2011 4:25 pm 
Offline

Joined: Mon Sep 06, 2010 7:02 pm
Posts: 15
perhaps I need a reference to an external jquery library put somewhere?


Top
 Profile  
 
 Post subject: Re: Hide date created and created by...
PostPosted: Tue Apr 05, 2011 4:40 pm 
Offline

Joined: Mon Sep 06, 2010 7:02 pm
Posts: 15
ok I added jquery.js to the site assets folder and changed the code in my CEWP box to read:

<script src="/SiteAssets/jquery.js" type="text/javascript"></script><script language="javascript" type="text/javascript">


$("#ctl00_MSO_ContentDiv a[href*='_layouts/userdisp.aspx?ID=']").each(function() {
$(this).closest("span").remove();
});</script>

When I click on a list item I notice the JS error icon in the browser status bar.
The error reads
Message: Object expected
Line: 682
Char: 1
Code: 0

line 682 points to:

$("#ctl00_MSO_ContentDiv a[href*='_layouts/userdisp.aspx?ID=']").each(function() {


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group