Hi all I need some help with a form Basically I have a HTML form that allows attachments However it also has a JS file attached to it with is causing me problems. The JS is meant to process the form but it wont process the form and send it if there is no attachment The form is below. I have done the obvious things like change from false to true and back again Removed the if statement and tried to put in an else but I have had no luck As I said if there is a file attached it works fine but if not the send button s dead Any ideas function enableUpload() { var uploadInput = document.getElementById('uploadInput'); if (uploadInput.value != ''){ //enables the submit button to upload the file document.getElementById('submitButton').disabled = false; //makes the file picker element invisible document.getElementById('uploadDiv').style.display = 'none'; //shows the element which show the filename document.getElementById('selectedFileDiv').style.display = ''; //removes span content and add the file name var filenameSpan = document.getElementById('filename'); while( filenameSpan.firstChild ) { filenameSpan.removeChild( filenameSpan.firstChild ); } //adds the filename to the span filenameSpan.appendChild( document.createTextNode(uploadInput.value) ); } } function selectNewFile() { //shows the file picker element document.getElementById('uploadDiv').style.display = ''; //makes the element which show the filename invisible document.getElementById('selectedFileDiv').style.display = 'none'; //disable the submit button to upload the file document.getElementById('submitButton').disabled = true; //removes the file name in the input document.getElementById('uploadInput').value = ''; }// JavaScript Document Code (markup):
You didn't actually include the form it's trying to process -- but generally speaking it looks like you've gotten a bit too complex for your own good manipulating style values that should be handled with a class swap, functional code instead of event attachments, etc, etc... Really though without seeing the markup being manipulated, the scripting is gibberish... scripting without seeing how the markup is calling it or how it's being attached to the markup; might as well be an alien language.