williadn48
Programmer
How do I write the following code in javascript:
function DoMultipleActions(){
DoFormChecks();
If DoFormChecks = pass then keep going
WriteStartTime();
else
DoFormChecks() again
end if
ChangeBtns_frmFlds1();
StartTimer();
}
My current code (below) will not pause and let me enter required data in the form and then go back and start over at DoFormChecks. It just keeps going.
function DoMultipleActions(){
DoFormChecks();
WriteStartTime();
ChangeBtns_frmFlds1();
StartTimer();
}
function DoFormChecks()
{
var selFA = document.frmTIMETRACKING.drpeFUNCAREA.value;
var selSF = document.frmTIMETRACKING.drpeSUBFUNC.value;
var inpBatches = document.frmTIMETRACKING.veBatches.value;
var inpComments = document.frmTIMETRACKING.veCOMMENTS.value;
//If Func Area = QC and...
if (selFA == 100)
{
//If Sub Func = Auditing...
if (selSF == 120)
{
//...then a number of batches must be entered.
if (inpBatches == "")
{
alert("You must enter number of batches.");
document.frmTIMETRACKING.btnStart.disabled = false;
return false;
}
}
}
//If Func Area = QC and...
if (selFA == 100)
{
//If Sub Func = System Errors or Other...
if (selSF == 121 || selSF == 8)
{
//...then comments must be entered.
if (inpComments == "")
{
document.frmTIMETRACKING.btnStart.disabled = false;
alert("You must enter comments.");
return false;
}
else
{
return true;
}
}
}
//If Func Area = Misc. and...
if (selFA == 102)
{
//If Sub Func = Meetings or Training or Projects...
if (selSF == 124 || selSF == 126 || selSF == 127)
{
//...then comments must be entered.
if (inpComments == "")
{
alert("You must enter comments.");
document.frmTIMETRACKING.btnStart.disabled = false;
return false;
}
}
}
}
function DoMultipleActions(){
DoFormChecks();
If DoFormChecks = pass then keep going
WriteStartTime();
else
DoFormChecks() again
end if
ChangeBtns_frmFlds1();
StartTimer();
}
My current code (below) will not pause and let me enter required data in the form and then go back and start over at DoFormChecks. It just keeps going.
function DoMultipleActions(){
DoFormChecks();
WriteStartTime();
ChangeBtns_frmFlds1();
StartTimer();
}
function DoFormChecks()
{
var selFA = document.frmTIMETRACKING.drpeFUNCAREA.value;
var selSF = document.frmTIMETRACKING.drpeSUBFUNC.value;
var inpBatches = document.frmTIMETRACKING.veBatches.value;
var inpComments = document.frmTIMETRACKING.veCOMMENTS.value;
//If Func Area = QC and...
if (selFA == 100)
{
//If Sub Func = Auditing...
if (selSF == 120)
{
//...then a number of batches must be entered.
if (inpBatches == "")
{
alert("You must enter number of batches.");
document.frmTIMETRACKING.btnStart.disabled = false;
return false;
}
}
}
//If Func Area = QC and...
if (selFA == 100)
{
//If Sub Func = System Errors or Other...
if (selSF == 121 || selSF == 8)
{
//...then comments must be entered.
if (inpComments == "")
{
document.frmTIMETRACKING.btnStart.disabled = false;
alert("You must enter comments.");
return false;
}
else
{
return true;
}
}
}
//If Func Area = Misc. and...
if (selFA == 102)
{
//If Sub Func = Meetings or Training or Projects...
if (selSF == 124 || selSF == 126 || selSF == 127)
{
//...then comments must be entered.
if (inpComments == "")
{
alert("You must enter comments.");
document.frmTIMETRACKING.btnStart.disabled = false;
return false;
}
}
}
}