Ask a questionAsk a question
 

AnswerDisable all day event in Calendar list

  • Friday, June 26, 2009 4:49 PMpl7626 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi there,

    Is there anyway of disabling the All day Event field in a Calendar list. I don't have the option to hide it either.

Answers

  • Friday, July 03, 2009 12:46 PMSP RAJ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Parvez, you can use Office Toolbox feature available on Codeplex, which allows site users to get greater control of your New/Edit/Display forms and their fields for show/hide and also field validations

    Hope this helps.

All Replies

  • Friday, June 26, 2009 5:03 PMKyle Schaeffer Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    If you re-create the form in a new ASPX page using a data view web part, you should be able to edit the form XSL in order to remove the checkbox.

  • Friday, June 26, 2009 7:59 PMKolbyH - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Yes, I would agree with Kyle. You can re-create the New and Edit forms to remove the all day option - that way a user can't create an all day event. 
  • Friday, June 26, 2009 8:08 PMDavid Lozzi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    You could use javascript on the page, instead of breaking the page inheritance using SPD, to hide the row. Using SPD, throw this at the bottom, outside of the web part zone

    <script language="javascript">
    function HideField(title){
    for(var i = 0; i < document.all.length; i++)
    {
        var el = document.all[i];
        // find html element with specified title
       if(el.title == title)
        {
            var pars;
            pars = el;
            for(var j = 0; j < 10; j++)
            {
                //loop through parents and hide the parent row
               if(pars.className == "ms-formbody")
                    break; //should have the TD object now

                pars = pars.parentNode;
            }         
            pars = pars.parentNode; //get the TR object
            pars.style.display = "none"; //and hide the row
            break;        
        }
    }
    }
    {

    HideField("All Day Event");
    }</script>


    I've written a webpart that also handles this much easier, if you're interested let me know and I'll send it over. Hoping to get it to codeplex soon.
    HTH


    David Lozzi
    Delphi Technology Solutions
    Blog  |  LinkedIn | Twitter
  • Tuesday, June 30, 2009 5:05 PMpl7626 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Hi David,

    When I tried the javascript, it didn't work on the Display form. I modified the script a little and now it works on all three forms (display, edit, new). Here's what I used:

    <script type="text/javascript">
    function HideField(title){
    var header_h3=document.getElementsByTagName("h3") ;
    
    for(var i = 0; i <header_h3.length; i++)
    {
        var el = header_h3[i];
        var foundField ;
       if(el.className=="ms-standardheader")
        {
            for(var j=0; j<el.childNodes.length; j++)
            { 
                if(el.childNodes[j].innerHTML == title || el.childNodes[j].nodeValue == title)
                { 
                    var elRow = el.parentNode.parentNode ;
                    elRow.style.display = "none"; //and hide the row
                    foundField = true ;
                    break;
                }
            }        
        }
        if(foundField)
            break ;
    }
    }
    
    HideField("All Day Event");
    HideField("Recurrence") ;
    HideField("Workspace") ;
    </script>
    
    Kyle,

    I'm also interested to know how to recreate the forms in Sharepoint Designer. I'm new to Sharepoint Designer. Do you know of a specific article on creating these forms with the same look and feel as other pages in the site.
  • Tuesday, June 30, 2009 5:08 PMDavid Lozzi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Interesting... this works for me on the display forms... Thanks for the update!


    David Lozzi
    Delphi Technology Solutions
    Blog  |  LinkedIn | Twitter
  • Tuesday, June 30, 2009 5:20 PMpl7626 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I guess a more simpler solution would be to create a custom list with appropriate fields (start date, end date, etc.) and then creating a calendar view. But You don't get the option to connect it to Outlook 2007. And, when creating a custom list, creating calender view won't give the option for "All Event Event", "Workspace". It also won't have the "Recurrance" functionality.

    In my case, I don't need to (although I wanted to) connect it to Outlook 2007. I added some extra fields to the Calendar List, which doesn't appear in Outlook.
  • Thursday, July 02, 2009 10:46 PMsparkymark75 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    If it's a one-off administrative function, i.e the list is created and you simply want to hide the All Day Event field, you can download either SharePoint Manager (CodePlex) or WSS List Configurator (CodePlex) and use those to hide the field. You can even specify which forms to show it on or whether or not just to hide it full stop.
  • Friday, July 03, 2009 12:46 PMSP RAJ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Parvez, you can use Office Toolbox feature available on Codeplex, which allows site users to get greater control of your New/Edit/Display forms and their fields for show/hide and also field validations

    Hope this helps.