Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

SharePoint 2010 -

I am trying to set up a Calendar such that when a user clicks on an existing Calendar Item they immediately are in the Edit Form, not the Display Form. I can easily set a different form to be the default, but I do not see any way to set an Edit Form to be the default form for the Display Type. I attempted to change the in the EditForm.aspx:

http://schemas.microsoft.com/WebPart/v2/ListForm">PAGE_EDITFORM</PageType> !--> http://schemas.microsoft.com/WebPart/v2/ListForm">PAGE_DISPLAYFORM

thinking that this might be what was controlling the Type of the form, but this did not work either, the Type still appears as Edit, not Display.

Any ideas? Is there just a place I have missed that allows this to be changed? So far searching has found nothing on this, at least not that I have found.

Thanks,

Bill Dewey

share|improve this question
    
How are you trying to achieve this? Through SharePoint Designer, SharePoint User Interface or through code? –  Vardhaman Deshpande Jul 26 '12 at 15:40
    
I would prefer to do this via SharePoint Designer, but as long as I can do something that is not difficult to maintain any method would work.. I have a feeling that this is a "hidden" value somewhere. Do you have a Magic Solution for me? –  BDewey Jul 26 '12 at 15:53
    
If this is a Code solution, I may need pointers in how to implement. Thanks, –  BDewey Jul 26 '12 at 16:00

2 Answers 2

Here is some jQuery that would do the trick, using it to fix some corrupted calendars that keep pointing to the editform instead of the dispform. I've modified it for your situation.

Place this in a js file and store it in a document library on your site. Add a content editor web part on your desired page(s) and point the content link to the file.

<script type="text/javascript" src ="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() { 
   //find all hyperlinks in the table holding calendar links and 
   //change them to point at the display page instead of the edit page 
$("table[id^='CalViewTable']").find("a[href*='DispForm.aspx']").each(function(){
   var originalUrl = $(this).attr("href"); 
   var newUrl = originalUrl.replace("DispForm.aspx", "EditForm.aspx"); 
    $(this).attr("href", newUrl); 
}); 

$(".ms-cal-muworkitem").find("td[href*='DispForm.aspx']").each(function(){
   var originalUrl = $(this).attr("href"); 
   var newUrl = originalUrl.replace("DispForm.aspx", "EditForm.aspx"); 
    $(this).attr("href", newUrl); 
}); 


}); 

$("img[alt*='Month']").live('click',function(){
   var originalUrl = $(this).attr("href"); 
   var newUrl = originalUrl.replace("DispForm.aspx", "EditForm.aspx"); 
    $(this).attr("href", newUrl); 
}); 
</script>

Also in SharePoint Designer, if you select your list and right click it, you can go to the properties. In there, there will be a Supporting Files tab. You could set the default dispform to the editform.

share|improve this answer
    
Thanks. The simple "set the default dispform" in SPD is what I tried first. But in SPD it appears that the Default is set based on the Type of the form, so I don't see a way to set a form of type Edit to be the default for type Display. If I missed something, please point me to it. I have tried to implement your JavaScript solution, which looks nice, thank you, but I think I am missing the proper setting for the id in the line where you have 'CalViewTable'. What should this contain when there is no specific Table Id? –  BDewey Jul 26 '12 at 17:28
    
The script is assuming you have a calendar web part on your page. So when they click on any event, they are taken to the editform for the page. –  PirateEric Jul 26 '12 at 17:44
    
AS for the supporting files, it should allow you to click the Browse button and navigate to the editform page of the library. –  PirateEric Jul 26 '12 at 17:45
    
I should have specified, this is SharePoint 2010 I am working with. I can get to the editform, and I can set the Default, the problem is that I do not see a way to say "Set the EditForm.aspx to be the Default for the Display Form". I do not recall if this was different in 2007, but if you could post the steps for SPD 2010, I'll owe you lunch :-). I have tried the script on a page with the standard web part, but it still does not work. This again could be an issue of SP 2010, as I do not see the same class in my page that is in your script: .ms-cal-muworkitem. –  BDewey Jul 26 '12 at 18:54
    
This was indeed for 2007. –  PirateEric Jul 26 '12 at 19:24

I am assuming you have jQuery. Include the following code in either your Page or the Master Page:

<script>
jQuery(document).ready(function(){

    //Find each title of the event from the page.
    jQuery("div.ms-acal-title").find("a").each(function(){
        //Replace the DispForm with EditForm in the href of the a link.
        var aLink = jQuery(this);
        aLink.attr("href",aLink.attr("href").replace("DispForm.aspx","EditForm.aspx"));
    });

});
</script>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.