I’m new at javascripts so forgive me if this seems obvious but what I want is to start a second function oly if all the condtitions of the previous function actions returned false
function validateForm()
{
var file = document.getElementById('file');
if (file.files[0].size >= 11000000) {
alert('File too Big');
return false;
}
var x=document.forms["myForm"]["title"].value;
if (x==null || x==""){
alert("First name must be filled out");
return false;
}
// if both returned false then start this function:
function start_Uploading(){
document.getElementById('message').innerHTML = 'Loading...';
return true;
}
the html:
<input type='submit' onclick="return validateForm();">
Your return values end the function call. You just want to set a variable to see if the input is valid. You can then check and see if the isValid is true, and call your function from there.
Also worth noting in your original code that
doesn’t actually run the function, it just defines it. You need
start_uploading()to execute the function.