473,320 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

duplicate file verification

chunk1978
224 100+
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?

Expand|Select|Wrap|Line Numbers
  1.  
  2. function ValidateDuplicateFile()
  3.      {
  4.      var File1 = document.form.file1.value;
  5.      var File2 = document.form.file2.value;
  6.  
  7.      if (File1 = File2){
  8.      alert( "Both of your files are the same" );
  9.      document.form.file1.value.focus();
  10.      return false;}
  11.  
  12.      return true;
  13. }
  14.  
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!
Jan 30 '07 #1
3 1245
acoder
16,027 Expert Mod 8TB
I've modified your code below:
Expand|Select|Wrap|Line Numbers
  1. function ValidateDuplicateFile()
  2.      {
  3.      var File1 = document.form.file1.value;
  4.      var File2 = document.form.file2.value;
  5.  
  6.      if (File1 == File2){
  7.      alert( "Both of your files are the same" );
  8.      document.form.file1.focus();
  9.      return false;}
  10.  
  11.      return true;
  12. }
Notice the changes I made:
1. File1=File2 replaced by File1==File2 (comparing instead of assigning/setting).
2. focus() is a method of the file input object, not value (which is an attribute of the file input object and therefore cannot have methods).
Jan 30 '07 #2
chunk1978
224 100+
I've modified your code below
excellent... thanks again acoder!
Jan 30 '07 #3
acoder
16,027 Expert Mod 8TB
No problem. You're welcome.
Jan 30 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Lowell Kirsh | last post by:
I have a script which I use to find all duplicates of files within a given directory and all its subdirectories. It seems like it's longer than it needs to be but I can't figure out how to shorten...
44
by: Xah Lee | last post by:
here's a large exercise that uses what we built before. suppose you have tens of thousands of files in various directories. Some of these files are identical, but you don't know which ones are...
12
by: Jared Carr | last post by:
First I wish I knew how this was caused but here is our problem. Sometime in the recent past we got a duplicate table. Here is the result of a pg_dump with a pg_restore for just that table. ...
2
by: news | last post by:
I just upgraded to PHP 4.4.2 on my Slackware 10.2 system. And Apache/mySQL/PHP all work great through a browser. No errors. But when I try to run a PHP script through the command line, which I...
7
by: ucfcpegirl06 | last post by:
Hello, I have a dilemma. I am trying to flag duplicate messages received off of a com port. I have a software tool that is supposed to detect dup messages and flag and write the text "DUP" on...
13
by: Kal | last post by:
I have a small console app that started out in dotnet 1.1 in VS 2003. That version can be copied to a W2K3 server where it runs fine. I set up a new project in VS 2005 and copied the code files...
5
by: rob | last post by:
Does anyone know of a duplicate file checker project in C#? Couldn't locate anything on CodeProject or SourceForge. Has anyone here considered writing one?
40
by: =?iso-8859-1?B?QW5kcuk=?= | last post by:
I'm really annoyed at Python - and not for the reasons already mentioned on this list. Everyone know that programming is supposed to be a dark art, nearly impossible to learn. Computer code is...
0
by: BrophyJeff | last post by:
I am putting together a system that uses Authenticode to verify that critical files are not tampered with. This is one of the purposes for Authenticode. At run-time, I use CAPICOM to verify that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.