Validation only if item is eneabled
--------------------------------------------------------------------------------
Need help everyone...
I have a form that is validated by javascript, pretty standard no errors works gret.
I have a file form element that is only enabled, if, one or two items from a select box are chosen...this also works.
The part I am having trouble with is that when the file form element is enabled I want to make sure that it is not left blank.
here is my code so far...
Code:
function validate1() {
var theMessage = "All fields in this form are required. \n"
theMessage = theMessage + "\n Please complete the following:"
theMessage = theMessage + "\n-----------------------------------\n";
var noErrors = theMessage
if (document.theForm.ImageUpload.enabled==true) {
//Make sure a text box is filled
if (document.theForm.ImageUpload.value=="") {
theMessage = theMessage + "\n --> Please choose a graphic to upload.";
} else {
}
// If no errors, submit the form
if (theMessage == noErrors) {
return true;
} else {
// If errors were found, show alert message
alert(theMessage);
return false;
}
}
There are no errors but no validation either...I need help!