horseatingweeds Posted July 20, 2007 Share Posted July 20, 2007 I'm writing a script to check several form elements, several of them are file inputs. I've found that only the first file element with contents will be checked, the rest are ignored as is the script written to check them. Is this something inherent in file fields? Here's the page if you want to take a look: http://www.gentledoberman.com/test-input.php Do I need to put each file input in a separate form perhaps? Link to comment https://forums.phpfreaks.com/topic/60890-validating-multiple-file-input-elements/ Share on other sites More sharing options...
roopurt18 Posted July 20, 2007 Share Posted July 20, 2007 In your input_formCheck.js: // ... }else if (form.fileImg1.value.length > 0){ alert(''); }else{ returnValue = true; } Perhaps if you actually checked the values of form.fileImg2.value.length and form.fileImg3.value.length you could validate them. Also, I noticed you're looking at file extensions to determine MIME type; that's considered bad practice. Link to comment https://forums.phpfreaks.com/topic/60890-validating-multiple-file-input-elements/#findComment-303671 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.