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

I created a contentType in the calendar list and then I created a page with a week view for those contentType items.

Now when someone clicks on a time slot to create a new item for the calendar it defaults to the original Event content type instead of the newly created one. So to solve this I created a content editor web part on the page with the following javascript to override the function

<script type="text/javascript">

window.ClickTime = function(sourceURL, urlTime){

     alert('clicked' + sourceURL + ' ' + urlTime);
     var url = sourceURL + '?CalendarTime=' + urlTime + '&ContentTypeId=0x0112315EF8B9141AEDAC0008BA02586654D60FF0A5F76272ED939F4DAC57F42F38936B52&source=' + document.URL ;
    window.location = url; 
}

</script>

Now this is where things get weird. When I'm in edit page mode it works perfectly, but outside of edit page mode it still goes to the default contentType. I've tried putting the webpart in first and last and still nothing.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

document.ClickTime = function ..... worked

share|improve this answer
add comment

Your Answer

 
discard

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