Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My Functions in One Function Are Ignored

Status
Not open for further replies.

williadn48

Programmer
Oct 27, 2006
29
US
This doesn't work:
...onclick='DoMultipleActions()'


function DoMultipleActions(){
WriteStartTime();
ChangeBtns_frmFlds1();
StartTimer();
}
Well, the only function that works is the WriteStartTime function.

function WriteStartTime()
{ frmTIMETRACKING.hdnAction.value = 'Start';
frmTIMETRACKING.submit();
return false;
}
function ChangeBtns_frmFlds1()
{
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.");
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 == "")
{
alert("You must enter comments.");
return false;
}
}
}
//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.");
return false;
}
}
}
document.frmTIMETRACKING.btnStop.disabled = false;
document.frmTIMETRACKING.btnStart.disabled = true;

document.frmTIMETRACKING.drpeFUNCAREA.disabled = true;
document.frmTIMETRACKING.drpeSUBFUNC.disabled = true;
document.frmTIMETRACKING.veBatches.disabled = true;
document.frmTIMETRACKING.veCOMMENTS.disabled = true;
return false;
}
var timerID = 0;
var tStart = null;

function UpdateTimer() {
if(timerID) {
clearTimeout(timerID);
clockID = 0;
}

if(!tStart)
tStart = new Date();

var tDate = new Date();
var tDiff = tDate.getTime() - tStart.getTime();

tDate.setTime(tDiff);

document.frmTIMETRACKING.theTime.value = ""
+ tDate.getMinutes() + ":"
+ tDate.getSeconds();

timerID = setTimeout("UpdateTimer()", 1000);
}

function StartTimer() {
tStart = new Date();

document.frmTIMETRACKING.theTime.value = "00:00";

timerID = setTimeout("UpdateTimer()", 1000);
return false;
}
 
Do you you get any errors appearing? Try using Firefox and looking in the JavaScript console. Does any of the second function execute? Do you see any messages / alerts?

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
I'd EXPECT that function to be the only one that works. In it you submit the form, which would probably pretty much end anything else happening on your page. It's probably doing exactly what you programmed it to do.

Lee
 
I am a newbie. So how do I (using javascript) submit a write to the db and come back to continue processing?
 
This isn't a "newbie" answer, but it's the only one that fits your criteria: Use AJAX.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top