I have a Javascript validation routine that runs on a Domino web form. I need two more validations done that are giving me trouble. Here is the situation
Start Time is entered in this field ="twField0"
End Time is entered in this field = "twField4"
Times are entered in this format (hh:mm AM/PM) and the user does not have the ability to deviate from this format.
I need to check that the period between the "start time" and the "end time" does not cross midnight. If it does, throw an alert and do not allow user to continue.
I also need to check that the duration between "start time" and "end time" does not exeed 12 hours. If it does throw an alert but allow user to continue.
The data entry is occuring in a form that passes the values to the parent form so the entry form never gets submitted to the server. This is why the validation must happen within this function.
Here is the existing code that is in the JS header of the form. All of these validations are currently working fine.
function twValidateRecord(intThisRecord) {
if (window.document.forms[0].twField0.value.length==0) {alert("Date cannot be empty"
; return false;};
if (window.document.forms[0].twField1.value.length==0) {alert("Start Time cannot be empty"
; return false;};
if (window.document.forms[0].twField4.value.length==0) {alert("End Time cannot be empty"
; return false;};
if ((window.document.forms[0].twField3.value.length==0) && (window.document.forms[0].twField2.value.length!==0))
{alert("Need an In From lunch value"
; return false;};
if ((window.document.forms[0].twField2.value.length==0) && (window.document.forms[0].twField3.value.length!==0))
{alert("Need an Out to lunch value"
; return false;};
return true;
}
Start Time is entered in this field ="twField0"
End Time is entered in this field = "twField4"
Times are entered in this format (hh:mm AM/PM) and the user does not have the ability to deviate from this format.
I need to check that the period between the "start time" and the "end time" does not cross midnight. If it does, throw an alert and do not allow user to continue.
I also need to check that the duration between "start time" and "end time" does not exeed 12 hours. If it does throw an alert but allow user to continue.
The data entry is occuring in a form that passes the values to the parent form so the entry form never gets submitted to the server. This is why the validation must happen within this function.
Here is the existing code that is in the JS header of the form. All of these validations are currently working fine.
function twValidateRecord(intThisRecord) {
if (window.document.forms[0].twField0.value.length==0) {alert("Date cannot be empty"
if (window.document.forms[0].twField1.value.length==0) {alert("Start Time cannot be empty"
if (window.document.forms[0].twField4.value.length==0) {alert("End Time cannot be empty"
if ((window.document.forms[0].twField3.value.length==0) && (window.document.forms[0].twField2.value.length!==0))
{alert("Need an In From lunch value"
if ((window.document.forms[0].twField2.value.length==0) && (window.document.forms[0].twField3.value.length!==0))
{alert("Need an Out to lunch value"
return true;
}