Window.location.href causes form not to submit/save?

Hi everyone, this is puzzling, the following javascript code in a submit button checks for a checkbox being checked, if so, it autoselects a value in another field, if not then the value in the other field remains and if both fields are blank, an input validation error message appear directing the user back to the field where a selection must be made.

The above works great but instead of “Form processed” I’d like to automatically direct the user to a URL, when I leave the line of code:

window.location.href=‘Calendar?OpenView’; at the end of the script the document doesn’t get saved to the database (although the url does indeed open), when I take out that one line, everything works fine but the user doesn’t get redirected?

any ideas?

tks,

-MC

PS I tried using $$return but that just gives me a blank page

— BEGIN CODE —

sisChecked = false;

eisChecked = false;

if (form.StartTimeAllDay.checked ) {

sisChecked = true;

}

if (form.EndTimeAllDay.checked ) {

eisChecked = true;

}

if (document.forms[0].StartTime.selectedIndex == 0 && ! sisChecked

) {

alert(“Please select a start time.”);

document.forms[0].StartTime.focus();

return false;

}

if (document.forms[0].EndTime.selectedIndex == 0 && ! eisChecked

) {

alert(“Please select an end time.”);

document.forms[0].EndTime.focus();

return false;

}

if (sisChecked)

{

document.forms[0].StartTime.selectedIndex = 1;

}

if (eisChecked)

{

document.forms[0].EndTime.selectedIndex = 26;

}

document.forms[0].submit();

window.location.href=‘Calendar?OpenView’;

Subject: window.location.href causes form not to submit/save?

You are changing the current window’s location before the data are posted to the server. Use a $$Return field on your form to redirect the user after the save. The related Help entry is titled:

Customizing the “Form processed” confirmation for Web users

Subject: SOLUTION: window.location.href causes form not to submit/save?

see my post here:http://www-10.lotus.com/ldd/nd6forum.nsf/ShowMyTopicsAllThreadedweb/c930901b16d7c9248525700c005c19ca?OpenDocument

Hope this helps someone,

-MC