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!

After Form Submit How Do I Enable Buttons

Status
Not open for further replies.

williadn48

Programmer
Oct 27, 2006
29
US
I have the submit form working ok and I get the form back, but how do I force buttons to enable/disable and gray out fields? I need to write an initial starttime record to the db first and then continue processing or leave the form up on the screen for the user. The user will click stop eventually.
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 == "")
{
document.frmTIMETRACKING.btnStart.disabled = false;
alert("You must enter number of batches.");
return false;

}
}
}
else
//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
//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 == "")
{document.frmTIMETRACKING.btnStart.disabled = false;
alert("You must enter comments.");

return false;
}
}
}
document.frmTIMETRACKING.btnStop.disabled = false;
document.frmTIMETRACKING.btnStart.disabled = true;

frmTIMETRACKING.hdnAction.value = 'Start';
frmTIMETRACKING.submit();

}
Why does the document.frmTIMETRACKING.btnStop.disabled = false; line not work above right before the .submit() action?
 
Put together a mini-example showing just the area you want assistance on - this also helps you to clarify the problem at hand. It also makes it less daunting for others to attempt to help. An explanation of what you have done already also helps.

Then write some code to test this... code that you can throw away once you've found the solution.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top