Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9260923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T13:01:19+00:00 2026-06-18T13:01:19+00:00

Aloha All, I’m using a SharePoint 2007 calendar with four content types. Standard Meeting

  • 0

Aloha All,
I’m using a SharePoint 2007 calendar with four content types.

  1. Standard Meeting
  2. Skype Meeting
  3. Telephone Meeting
  4. Chat Meeting

I’m using JQuery 1.4.2.

I’m trying to create an alert popup on the calendar page for Skype meetings that are scheduled less than 72 hours in advance. I have the alert built into the Calendar page to show up if “SkypeError=1” is passed in the URL.

Right now I’m trying to get the NewForm.aspx to recognize that the Skype Meeting content type has been selected and display the error. In the PreSaveAction function I have an alert showing that the ContentTypeId is being recognized, another alert to show what dynamic URL has been selected. Then in the setOnSubmitRedir function I have an alert showing that the same URL was passed into it and another alert to show the full url was modified for the Submit button.

When adding a Satandard Meeting to the calendar everything works fine as expected. However, if I choose any of the other content types only the cancel button works. If I press Submit I get the generic MOSS2007 “An unexpected error has occurred.” which is odd considering I can see the correct info is being passed through. Plus when I look at the URL of the error page I see it there:
https://myURL/myPortal/Lists/ConfRes/NewForm.aspx?RootFolder=%2fmyPortal%2fLists%2fConfRes&Source=/myPortal/Pages/MeetingCalendar.aspx?SkypeTime=yes

I’ve tried removing “?SkypeTime=yes” from dynamic redirect thinking maybe the “?” was causing issues.
Everything seems to fail when it’s saving the content. The content is never saved when getting the error. When I remove the code from the page the submit works fine for all content types.

Assistance is greatly appreciated and needed. Any help with also figuring out how to test for events added less than 72 hours from the start time is also greatly appreciated.

The code is added using a CEWP. I don’t have server rights to enable more robutst errors or look at the logs.

<script type="text/javascript" src="/94thaamdc/SiteCollectionCode/jquery-1.4.2.min.js">
//Load JQuery
</script>

<script type="text/javascript">
// Where to go when cancel is clicked on the form
goToWhenCanceled = '/myPortal/Pages/MeetingCalendar.aspx';
// Edit the redirect on the cancel-button's
$('.ms-ButtonHeightWidth[id$="GoBack"]').each(function(){
    $(this).click(function(){
            STSNavigate(goToWhenCanceled);
      })
});

// Function to determine the dynamic URL for the OnSubmit-redirect.
// This function is automatically executed before saving the item.
function PreSaveAction(){
// The URL is determined by the ContentTypeId located in the URL of the content type link.
// Grab the ContentTypeId from the content type link's URL and save it to a local
// variable called contentTypeId.
var contentTypeId = querySt("ContentTypeId");
// Assign a dynamic redirect URL to the function by setting it here
// based on contentTypeId from the URL.
    if(contentTypeId=='0x010...'){
        var dynamicRedirect = '/myPortal/Pages/MeetingCalendar.aspx?SkypeError=1';
    }else{
        var dynamicRedirect = '/myPortal/Pages/MeetingCalendar.aspx';
    }
    // Alerts are just to watch what's going on in the code. Remove when done testing.
    alert("1. contentTypeId:  "+contentTypeId);
    alert("2. dynamicRedirect:  "+dynamicRedirect);
    // Call the function and set the redirect URL in the form-action attribute
    setOnSubmitRedir(dynamicRedirect);
    // This function must return true for the save item to happen
    return true;
}

//Function to parse the ContentTypeId from the URL string
function querySt(stKey) {
    stQString = window.location.search.substring(1);
    arKeyValues = stQString.split("&");
    for (i = 0; i < arKeyValues.length; i++) {
        arPairs = arKeyValues[i].split("=");
        if (arPairs[0] == stKey) {
            return arPairs[1];
        }
    }
};

// Function to edit the form-action attribute to add the source=yourCustomRedirectPage
function setOnSubmitRedir(redirURL){
var action = $("#aspnetForm").attr('action');
var end = action.indexOf('&');
    if(action.indexOf('&')<0){
        newAction = action + "?Source=" + redirURL;
    }else{
        newAction = action.substring(0,end) + "&Source=" + redirURL;
    }
$("#aspnetForm").attr('action',newAction);
// Test to see if the URL was passed correctly. Remove when done testing.
alert("3. redirURL:  "+redirURL);
// Test to see if the new URL is properly formatted. Remove when done testing.
alert("4. newAction:  "+newAction);
}
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T13:01:20+00:00Added an answer on June 18, 2026 at 1:01 pm

    Since I couldn’t figure out why the redirect wasn’t working I took another path that doesn’t require it. I’d still like to know what’s wrong with the original attempt though. I need to improve the actual warning box that pops up but the below code works well. The warning only displays for the person who entered the event and it shows up each time they go to the calendar until they enter a new event over 72 hours prior.

    <script type="text/javascript" language="javascript" src="/myPortal/jquery.1.4.2.min.js"></script>
    <script type="text/javascript" language="javascript" src="/myPortal/jquery.SPServices-0.7.2.min.js"></script>
    <script type="text/javascript" language="javascript">
    /*
    Name:           EventTimeLimit
    Developer:      RogueVeggie
    Version - Date: v1 - 20130207
    
    Purpose:        Test if a Skype meeting has been added less than 72 hours prior to 
                    the actual meeting time in a SharePoint Calendar.
                    A warning displays if this is the last event entered by the user.
    
    Prerequisite:   Create a Content Type called "Skype Meeting".
                    In the SharePoint calendar Create a Calculated column called Skype72hrTest.
                    Paste the following script into it:
    
                    IF([Content Type]="Skype Meeting",IF([Sit Down Time]-Created>=3,"Pass","Fail"),"NA")
    
                    Add this code to a Content Editor Web Part at the bottom of your SharePoint 
                    Calendar page.
                    Set the web part Chrome to "None".
                    Don't hide the web part or the warning won't display.
    */
    
    var taskListName = "MYGUID12-3456-7890-ASDF-GHJKLZXCVBNM" // This is the GUID of the list we want to query.
    var lastId = $().SPServices.SPGetLastItemId({ 
        listName: taskListName 
    }); // This gets the ID of the last event added by the current user.
    var testQuery = "<Query><Where><Eq><FieldRef Name='ID' /><Value Type='Text'>"+lastId+"</Value></Eq></Where></Query>"; // This is our CAML Query string.
    var divWarn = "<DIV style='Z-INDEX: 999; POSITION: absolute; PADDING-BOTTOM: 25px; BACKGROUND-COLOR: #800505; PADDING-LEFT: 25px; WIDTH: 743px; PADDING-RIGHT: 25px; HEIGHT: 175px; COLOR: white; FONT-SIZE: 150%; TOP: 55%; FONT-WEIGHT: 900; PADDING-TOP: 25px; LEFT: 22.38%' id='VTCWarn'><DIV style='FONT-SIZE: 200%'>WARNING:</DIV><DIV>Skype scheduling requires 72 hour notice to register.<BR>Please contact IT.</DIV></DIV>";//This is the warning message
    
    $(document).ready(function() {
      $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: taskListName ,
       CAMLRowLimit: 1,
        CAMLQuery: testQuery,
        CAMLViewFields: "<ViewFields><FieldRef Name='Skype72hrTest' /></ViewFields>",// Skype72hrTest is a calculated column in the calendar to test if the event was added less than 72 hours before the Skype meeting.
        completefunc: function (xData, Status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function() {
                var passFail = $(this).attr("ows_Skype72hrTest");// Skype72hrTest stores the result in a string as "Pass", "Fail", or "NA".
    
                if (passFail === "string;#Fail"){// Tests to see if the string Fail is in the Skype72hrTest column
                    $("#Warning").append(divWarn);
                }
            });
        }
      });
    });
    // The below DIV is needed so we have a place to put the warning when passFail=Fail.
    </script>
    <div id='Warning'></div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Aloha editor for editing content on a website powered by PHP and
aloha.js or aloha-full.js has code for all the plugins listed at its website. But,
I am currently using this regex to replace all non alpha numeric characters from
All UI Automation examples I've seen uses standard components whose state can be inspected
I am using the following css to make all items in the main DIV
I am using Aloha to edit contents on a client's website and want to
I've been using Aloha Editor to create an example of a simple editor ,
I've got the following code, and need to strip all non alpha numeric characters.
I'm trying to retrieve all columns that start with any non alpha characters in
As I know alpha composition uses straight alpha basically. But all GLES blending sample

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.