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’;