hello. i'd like to know if there's a way in JavaScript to distinguish a difference between two file fields for verification.
on the form i am writing, there are 2 file fields far apart from each other, so a user does not see them on the same page level... therefore i think it would be a good idea to write a validation check to see if the user accidently entered the same file in both fields... however, i'm having a difficult time trying to imagine how i would do that...
perhaps something like the following?
sorry i have no way to test this right now, so if any of you JavaScript geniuses think this code would work for me, please let me know. thanks a lot!
on the form i am writing, there are 2 file fields far apart from each other, so a user does not see them on the same page level... therefore i think it would be a good idea to write a validation check to see if the user accidently entered the same file in both fields... however, i'm having a difficult time trying to imagine how i would do that...
perhaps something like the following?
Code:
function ValidateDuplicateFile() { var File1 = document.form.file1.value; var File2 = document.form.file2.value; if (File1 = File2){ alert( "Both of your files are the same" ); document.form.file1.value.focus(); return false;} return true; }
Comment